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