Commit | Line | Data |
---|---|---|
b2c5f619 MG |
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; | |
72d06895 GL |
10 | typedef signed char s8; |
11 | typedef short s16; | |
12 | typedef int s32; | |
13 | typedef long long s64; | |
b2c5f619 | 14 | |
656ad58e OH |
15 | /* required for opal-api.h */ |
16 | typedef u8 uint8_t; | |
17 | typedef u16 uint16_t; | |
18 | typedef u32 uint32_t; | |
19 | typedef u64 uint64_t; | |
20 | typedef s8 int8_t; | |
21 | typedef s16 int16_t; | |
22 | typedef s32 int32_t; | |
23 | typedef s64 int64_t; | |
24 | ||
b2c5f619 MG |
25 | #define min(x,y) ({ \ |
26 | typeof(x) _x = (x); \ | |
27 | typeof(y) _y = (y); \ | |
28 | (void) (&_x == &_y); \ | |
29 | _x < _y ? _x : _y; }) | |
30 | ||
31 | #define max(x,y) ({ \ | |
32 | typeof(x) _x = (x); \ | |
33 | typeof(y) _y = (y); \ | |
34 | (void) (&_x == &_y); \ | |
35 | _x > _y ? _x : _y; }) | |
36 | ||
37 | #endif /* _TYPES_H_ */ |