summaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'types.h')
-rw-r--r--types.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/types.h b/types.h
index 90a5b49..015fef2 100644
--- a/types.h
+++ b/types.h
@@ -5,6 +5,9 @@
#ifndef _TYPES_H
#define _TYPES_H
+#include <stddef.h>
+
+
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
@@ -13,14 +16,11 @@ typedef unsigned long long u64;
typedef signed short s16;
typedef signed int s32;
+
#define ARRAY_SIZE(x) (sizeof x / sizeof x[0])
-#if 0
-#define subtype(_type, _base, _field) \
- (void *)((u8 *)(_base) - __builtin_offsetof(_type, _field))
-#else
+
#define subtype(_type, _base, _field) \
- (void *)((u8 *)(_base) - ((u8 *)&(((_type *)0)->_field) - 0))
-#endif
+ (void *)((u8 *)(_base) - offsetof(_type, _field))
#endif