aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-09-19 22:39:04 +0000
committerPer Bothner <per@bothner.com>1995-09-19 22:39:04 +0000
commitb46805224b81b08335947252fc23d474b4bbc0a0 (patch)
tree39a9f4380a16d13a7e4e954fc9efbff54edd08da /gdb/gdbtypes.c
parenta56552441f1333d5f810157fb5e877cfafa45a7f (diff)
downloadgdb-b46805224b81b08335947252fc23d474b4bbc0a0.zip
gdb-b46805224b81b08335947252fc23d474b4bbc0a0.tar.gz
gdb-b46805224b81b08335947252fc23d474b4bbc0a0.tar.bz2
* gdbtypes.c (create_set_type): Set TYPE_LENGTH in bytes, not bits.
* valops.c (value_bitstring): TYPE_LENGTH is bytes, not bits. * gdbtypes.c (force_to_range_type): Calculate upper limit of TYPE_CODE_CHAR depending on TYPE_LENGTH (instead of just using 255).
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index de3de3e..ca27e4c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -368,7 +368,8 @@ force_to_range_type (type)
}
case TYPE_CODE_CHAR:
{
- struct type *range_type = create_range_type (NULL, type, 0, 255);
+ int char_max = 1 << (TYPE_LENGTH (type) * HOST_CHAR_BIT) - 1;
+ struct type *range_type = create_range_type (NULL, type, 0, char_max);
TYPE_NAME (range_type) = TYPE_NAME (range_type);
TYPE_DUMMY_RANGE (range_type) = 1;
return range_type;
@@ -469,8 +470,7 @@ create_set_type (result_type, domain_type)
high_bound = TYPE_HIGH_BOUND (domain_type);
bit_length = high_bound - low_bound + 1;
TYPE_LENGTH (result_type)
- = ((bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT)
- * TARGET_CHAR_BIT;
+ = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
}
TYPE_FIELD_TYPE (result_type, 0) = domain_type;
return (result_type);