aboutsummaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-05 19:56:04 -0700
committerMichael Forney <mforney@mforney.org>2019-04-06 12:01:51 -0700
commit2b95bd2fe11ac8e982fc88d42661bd5cf3f6e475 (patch)
tree50d656cb0a0e6251351e854b0f956752d47821e6 /expr.c
parenta8961c59fcc0c92806af1853b93c1bc69259ce5f (diff)
expr: Just use `unsigned long long` when calculating integer constant type
Ideally, we shouldn't use uint64_t at all since it is not guaranteed to exist, and this case is easy enough to fix.
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/expr.c b/expr.c
index 6af09c8..f8b2c05 100644
--- a/expr.c
+++ b/expr.c
@@ -216,7 +216,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expr *l, struct exp
}
static struct type *
-inttype(uint64_t val, bool decimal, char *end)
+inttype(unsigned long long val, bool decimal, char *end)
{
static struct {
struct type *type;
@@ -245,7 +245,7 @@ inttype(uint64_t val, bool decimal, char *end)
step = i % 2 || decimal ? 2 : 1;
for (; i < LEN(limits); i += step) {
t = limits[i].type;
- if (val <= (uint64_t)-1 >> (8 - t->size << 3) + t->basic.issigned)
+ if (val <= 0xffffffffffffffffu >> (8 - t->size << 3) + t->basic.issigned)
return t;
}
error(&tok.loc, "no suitable type for constant '%s'", tok.lit);