summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-13 04:29:01 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-17 21:56:32 +0100
commit63d65194edf1ab5017a4faebed7f816e5cbc24bd (patch)
treee2bcfcb80e54c5a1c1ffb5dc76b558123554f339
parent749f0c51d1da0d89202cbbeba4b261994b4391f9 (diff)
downloadsparse-63d65194edf1ab5017a4faebed7f816e5cbc24bd.tar.gz
use the type for predefined_max()
-rw-r--r--lib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib.c b/lib.c
index e1970d89..dc4a2172 100644
--- a/lib.c
+++ b/lib.c
@@ -1151,8 +1151,10 @@ static void predefined_width(const char *name, unsigned bits)
predefine(buf, 1, "%d", bits);
}
-static void predefined_max(const char *name, const char *suffix, unsigned bits)
+static void predefined_max(const char *name, struct symbol *type)
{
+ const char *suffix = builtin_type_suffix(type);
+ unsigned bits = type->bit_size - is_signed_type(type);
unsigned long long max = bits_mask(bits);
char buf[32];
@@ -1174,10 +1176,8 @@ static void predefined_ctype(const char *name, struct symbol *type, int flags)
const char *suffix = (flags & PTYPE_T) ? "_T" : "";
predefined_sizeof(name, suffix, bits);
}
- if (flags & PTYPE_MAX) {
- const char *suffix = builtin_type_suffix(type);
- predefined_max(name, suffix, bits - is_signed_type(type));
- }
+ if (flags & PTYPE_MAX)
+ predefined_max(name, type);
if (flags & PTYPE_TYPE)
predefined_type(name, type);
if (flags & PTYPE_WIDTH)