1 #ifndef _TYPES_H_ 2 #define _TYPES_H_ 3 4 #include <stdbool.h> 5 6 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 7 8 typedef unsigned char u8; 9 typedef unsigned short u16; 10 typedef unsigned int u32; 11 typedef unsigned long long u64; 12 typedef signed char s8; 13 typedef short s16; 14 typedef int s32; 15 typedef long long s64; 16 17 /* required for opal-api.h */ 18 typedef u8 uint8_t; 19 typedef u16 uint16_t; 20 typedef u32 uint32_t; 21 typedef u64 uint64_t; 22 typedef s8 int8_t; 23 typedef s16 int16_t; 24 typedef s32 int32_t; 25 typedef s64 int64_t; 26 27 #define min(x,y) ({ \ 28 typeof(x) _x = (x); \ 29 typeof(y) _y = (y); \ 30 (void) (&_x == &_y); \ 31 _x < _y ? _x : _y; }) 32 33 #define max(x,y) ({ \ 34 typeof(x) _x = (x); \ 35 typeof(y) _y = (y); \ 36 (void) (&_x == &_y); \ 37 _x > _y ? _x : _y; }) 38 39 #define min_t(type, a, b) min(((type) a), ((type) b)) 40 #define max_t(type, a, b) max(((type) a), ((type) b)) 41 42 typedef int bool; 43 44 #ifndef true 45 #define true 1 46 #endif 47 48 #ifndef false 49 #define false 0 50 #endif 51 #endif /* _TYPES_H_ */ 52