Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 1 | #ifndef _TYPES_H_ |
| 2 | #define _TYPES_H_ |
| 3 | |
| 4 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| 5 | |
| 6 | typedef unsigned char u8; |
| 7 | typedef unsigned short u16; |
| 8 | typedef unsigned int u32; |
| 9 | typedef unsigned long long u64; |
| 10 | |
| 11 | #define min(x,y) ({ \ |
| 12 | typeof(x) _x = (x); \ |
| 13 | typeof(y) _y = (y); \ |
| 14 | (void) (&_x == &_y); \ |
| 15 | _x < _y ? _x : _y; }) |
| 16 | |
| 17 | #define max(x,y) ({ \ |
| 18 | typeof(x) _x = (x); \ |
| 19 | typeof(y) _y = (y); \ |
| 20 | (void) (&_x == &_y); \ |
| 21 | _x > _y ? _x : _y; }) |
| 22 | |
| 23 | #endif /* _TYPES_H_ */ |