Stefan Reinauer | 6ceed09 | 2013-04-08 16:55:47 -0700 | [diff] [blame] | 1 | |
| 2 | #include <arch/types.h> |
| 3 | |
| 4 | #ifndef __SIZE_TYPE__ |
| 5 | #define __SIZE_TYPE__ unsigned long |
| 6 | #endif |
| 7 | typedef __SIZE_TYPE__ size_t; |
Stefan Reinauer | f8b3650 | 2013-05-02 14:02:28 -0700 | [diff] [blame^] | 8 | /* There is a GCC macro for a size_t type, but not |
| 9 | * for a ssize_t type. Below construct tricks GCC |
| 10 | * into making __SIZE_TYPE__ signed. |
| 11 | */ |
| 12 | #define unsigned signed |
| 13 | typedef __SIZE_TYPE__ ssize_t; |
| 14 | #undef unsigned |
Stefan Reinauer | 6ceed09 | 2013-04-08 16:55:47 -0700 | [diff] [blame] | 15 | |
| 16 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) |
| 17 | |