Lichen

Changeset

910:a5450be2b2f2
2020-07-16 Paul Boddie raw files shortlog changelog graph 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.
templates/types.h (file)
     1.1 --- a/templates/types.h	Tue Jun 11 23:14:45 2019 +0200
     1.2 +++ b/templates/types.h	Thu Jul 16 16:56:24 2020 +0200
     1.3 @@ -127,8 +127,8 @@
     1.4  
     1.5  #define __INTVALUE(VALUE)   ((__attr) {.intvalue=((VALUE) << __NUM_TAG_BITS) | __TAG_INT})
     1.6  #define __TOINT(ATTR)       ((ATTR).intvalue >> __NUM_TAG_BITS)
     1.7 -#define __MAXINT            ((1 << ((sizeof(__attr) * 8) - 1 - __NUM_TAG_BITS)) - 1)
     1.8 -#define __MININT            (-(1 << ((sizeof(__attr) * 8) - 1 - __NUM_TAG_BITS)))
     1.9 +#define __MAXINT            ((1 << ((sizeof(int) * 8) - 1 - __NUM_TAG_BITS)) - 1)
    1.10 +#define __MININT            (-(1 << ((sizeof(int) * 8) - 1 - __NUM_TAG_BITS)))
    1.11  
    1.12  /* Argument lists. */
    1.13