1 #ifndef _DRAGONTYPE_NUMBER_H_
2 #define _DRAGONTYPE_NUMBER_H_
8 bool read_full(int fd, char *buffer, size_t size);
11 bool read_ ## type(int fd, type *ptr); \
12 bool write_ ## type(int fd, type val);
14 #define DEFBOX(type) \
15 typedef struct {v ## type min; v ## type max;} aabb ## type;
17 #define DEFVEC(type) \
18 typedef struct {type x, y;} v2 ## type; \
21 bool v2 ## type ## _equals(v2 ## type a, v2 ## type b); \
22 v2 ## type v2 ## type ## _add(v2 ## type a, v2 ## type b); \
23 typedef struct {type x, y, z;} v3 ## type; \
26 bool v3 ## type ## _equals(v3 ## type a, v3 ## type b); \
27 v3 ## type v3 ## type ## _add(v3 ## type a, v3 ## type b); \
28 typedef struct {type x, y, z, w;} v4 ## type; \
31 bool v4 ## type ## _equals(v4 ## type a, v4 ## type b); \
32 v4 ## type v4 ## type ## _add(v4 ## type a, v4 ## type b);
34 #define DEFTYP(from, to) \
39 #define DEFTYPES(bits) \
40 DEFTYP(int ## bits ## _t, s ## bits) \
41 DEFTYP(uint ## bits ## _t, u ## bits)