Remove BITS_IN_BYTES define
authorTom Tromey <tom@tromey.com>
Tue, 11 Jul 2017 12:44:36 +0000 (06:44 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 14 Aug 2017 16:14:06 +0000 (10:14 -0600)
While working on the previous patch, I noticed that BITS_IN_BYTES can be
replaced by HOST_CHAR_BIT, which is used more widely in gdb.

ChangeLog
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.

gdb/ChangeLog
gdb/valprint.c

index fd0f95988c405148d2f0f614dd7ee20862c0d7af..d85559551f8cfa7377efa52ebc0aee75a9a4b26f 100644 (file)
@@ -1,3 +1,9 @@
+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
index 9e216cff922a457669157df8b59ae90321e4c858..eef99b1f3b44c149e801723482c3698d79cb291e 100644 (file)
@@ -1490,9 +1490,6 @@ void
 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;
@@ -1512,7 +1509,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
          /* 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';
@@ -1532,7 +1529,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
           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';
@@ -1612,7 +1609,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
   /* 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);
This page took 0.03114 seconds and 4 git commands to generate.