diff options
author | Michael Forney <mforney@mforney.org> | 2024-03-21 16:43:00 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2024-03-21 17:33:40 -0700 |
commit | d1d23429f5dc3d78b03b318a7d349ad71a6c97fa (patch) | |
tree | 072e44175ebd75970565e9eb3b893bada3bbdd2a /type.c | |
parent | 8bed97beaea3839369a947ea741aa083e76ca014 (diff) |
decl: Add support for enums with large values and fixed underlying types
Fixes: https://todo.sr.ht/~mcf/cproc/64
Diffstat (limited to 'type.c')
-rw-r--r-- | type.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -261,6 +261,15 @@ typemember(struct type *t, const char *name, unsigned long long *offset) return NULL; } +bool +typehasint(struct type *t, unsigned long long i, bool sign) +{ + assert(t->prop & PROPINT); + if (sign && i >= -1ull << 63) + return t->u.basic.issigned && i >= -1ull << (t->size << 3) - 1; + return i <= 0xffffffffffffffffull >> (8 - t->size << 3) + t->u.basic.issigned; +} + struct param * mkparam(char *name, struct type *t, enum typequal tq) { |