# HG changeset patch # User Paul Boddie # Date 1594911384 -7200 # Node ID a5450be2b2f2d1844854e5f6ad82696dcf8af571 # Parent 5c6b1b19c6f6c9ceee49d728a0027d1b0496289a Fixed int limit macros by actually using the size of the int type. For wider types such as long, which may be usable on 64-bit platforms in place of int, 1L would need to be used instead of 1 in the calculation. An abstract native integer type might be introduced here and to the native library to allow wider types if appropriate. diff -r 5c6b1b19c6f6 -r a5450be2b2f2 templates/types.h --- a/templates/types.h Tue Jun 11 23:14:45 2019 +0200 +++ b/templates/types.h Thu Jul 16 16:56:24 2020 +0200 @@ -127,8 +127,8 @@ #define __INTVALUE(VALUE) ((__attr) {.intvalue=((VALUE) << __NUM_TAG_BITS) | __TAG_INT}) #define __TOINT(ATTR) ((ATTR).intvalue >> __NUM_TAG_BITS) -#define __MAXINT ((1 << ((sizeof(__attr) * 8) - 1 - __NUM_TAG_BITS)) - 1) -#define __MININT (-(1 << ((sizeof(__attr) * 8) - 1 - __NUM_TAG_BITS))) +#define __MAXINT ((1 << ((sizeof(int) * 8) - 1 - __NUM_TAG_BITS)) - 1) +#define __MININT (-(1 << ((sizeof(int) * 8) - 1 - __NUM_TAG_BITS))) /* Argument lists. */