1.1 --- a/templates/types.h Thu Nov 04 23:44:29 2021 +0100
1.2 +++ b/templates/types.h Thu Nov 04 23:57:33 2021 +0100
1.3 @@ -74,6 +74,11 @@
1.4 /* Introduce an integer type that is interoperable with the size type. */
1.5
1.6 typedef ssize_t __int;
1.7 +typedef size_t __uint;
1.8 +
1.9 +/* Introduce a floating point type. */
1.10 +
1.11 +typedef _Float64 __float;
1.12
1.13 /* Attribute value interpretations. */
1.14
1.15 @@ -82,7 +87,7 @@
1.16 /* General attribute members. */
1.17
1.18 __ref value; /* attribute value */
1.19 - __int intvalue; /* integer value data (shifted value, tagged) */
1.20 + uintptr_t rawvalue; /* raw attribute value used to test tagging */
1.21
1.22 /* Special case attribute members. */
1.23
1.24 @@ -127,8 +132,13 @@
1.25
1.26 #define __NUM_TAG_BITS 2
1.27 #define __TAG_INT 0b01
1.28 +#define __TAG_FLOAT 0b10
1.29 #define __TAG_MASK 0b11
1.30 -#define __INTEGER(ATTR) (((ATTR).intvalue & __TAG_MASK) == __TAG_INT)
1.31 +
1.32 +#if 0
1.33 +#define __INTEGER(ATTR) (((ATTR).rawvalue & __TAG_MASK) == __TAG_INT)
1.34 +#define __FLOAT(ATTR) (((ATTR).rawvalue & __TAG_MASK) == __TAG_FLOAT)
1.35 +#endif
1.36
1.37 /* Attribute value setting. */
1.38
1.39 @@ -136,12 +146,10 @@
1.40 #define __NULL __ATTRVALUE(0)
1.41 #define __SETNULL(ATTR) ((ATTR).value = 0)
1.42
1.43 -/* Attribute as instance setting. */
1.44 +/* Value limits. */
1.45
1.46 -#define __INTVALUE(VALUE) ((__attr) {.intvalue=(((__int) VALUE) << __NUM_TAG_BITS) | __TAG_INT})
1.47 -#define __TOINT(ATTR) ((ATTR).intvalue >> __NUM_TAG_BITS)
1.48 -#define __MAXINT ((((__int) 1) << ((sizeof(__int) * 8) - 1 - __NUM_TAG_BITS)) - 1)
1.49 -#define __MININT (-(((__int) 1) << ((sizeof(__int) * 8) - 1 - __NUM_TAG_BITS)))
1.50 +#define __MAXINT ((((__uint) 1) << ((sizeof(__int) * 8) - 1)) - 1)
1.51 +#define __MININT (-(((__uint) 1) << ((sizeof(__int) * 8) - 1)))
1.52
1.53 /* Argument lists. */
1.54