9 #define offsetof(type, slot) ((long) ((char *) &(((type *) 0)->slot)))
11 #define getslot(type, slot) (((type *) 0)->slot)
12 #define sizeofslot(type, slot) (sizeof(getslot(type, slot)))
13 #define countofslot(type, slot) \
14 (sizeof(getslot(type, slot)) / sizeof(getslot(type, slot)[0]))
15 #define stringify(x) #x
16 #define indirect_stringify(x) stringify(x)
18 #define TYPE_SIGNED_P(type) (((type)-1)<0LL)
19 #define _64_BIT_VALUE_FITS_SIGNED_P(value) ( (value) <= 0x7FFFFFFFFFFFFFFFLL )
20 #define SLOT_SIGNED_P(result, type, slot) \
22 type slot_signed_p_struct; \
23 slot_signed_p_struct.slot = -1; \
24 (result) = slot_signed_p_struct.slot < 0; \
27 void type_name(FILE *output
, int signed_p
, int size
) {
30 case 1: fprintf(output
, ":int8"); break;
31 case 2: fprintf(output
, ":int16"); break;
32 case 4: fprintf(output
, ":int32"); break;
33 case 8: fprintf(output
, ":int64"); break;
38 case 1: fprintf(output
, ":uint8"); break;
39 case 2: fprintf(output
, ":uint16"); break;
40 case 4: fprintf(output
, ":uint32"); break;
41 case 8: fprintf(output
, ":uint64"); break;
49 fprintf(output
, "(cl:error \"No type of size ~D.\" %i)\n", size
);
52 char* print_double_for_lisp(double n
)
56 snprintf(buf
, 255, "(let ((*read-default-float-format* 'double-float)) (coerce (read-from-string \"%.20E\") 'double-float))", n
);