+2017-08-14 Tom Tromey <tom@tromey.com>
+
+ * valprint.c (print_octal_chars): Use HOST_CHAR_BIT.
+ (print_binary_chars): Likewise.
+ (BITS_IN_BYTES): Remove.
+
2017-08-14 Tom Tromey <tom@tromey.com>
PR gdb/21675
print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order, bool zero_pad)
{
-
-#define BITS_IN_BYTES 8
-
const gdb_byte *p;
unsigned int i;
int b;
/* Every byte has 8 binary characters; peel off
and print from the MSB end. */
- for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
+ for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++)
{
if (*p & (mask >> i))
b = '1';
p >= valaddr;
p--)
{
- for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
+ for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++)
{
if (*p & (mask >> i))
b = '1';
/* For 32 we start in cycle 2, with two bits and one bit carry;
for 64 in cycle in cycle 1, with one bit and a two bit carry. */
- cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL;
+ cycle = (len * HOST_CHAR_BIT) % BITS_IN_OCTAL;
carry = 0;
fputs_filtered ("0", stream);