aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-07-11 06:44:36 -0600
committerTom Tromey <tom@tromey.com>2017-08-14 10:14:06 -0600
commitd3abe1c8ef1ec9a90932b801138a144dcae95100 (patch)
tree11058d5e69302cbbd5597c44e4ce8b5e6251b519 /gdb
parentFix two regressions in scalar printing (diff)
downloadbinutils-gdb-d3abe1c8ef1ec9a90932b801138a144dcae95100.tar.gz
binutils-gdb-d3abe1c8ef1ec9a90932b801138a144dcae95100.tar.bz2
binutils-gdb-d3abe1c8ef1ec9a90932b801138a144dcae95100.zip
Remove BITS_IN_BYTES define
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/valprint.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fd0f95988c4..d85559551f8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
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
* valprint.c (LOW_ZERO): Change value to 034.
(print_octal_chars): Add static_asserts for octal constants.
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 9e216cff922..eef99b1f3b4 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -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);