-
Notifications
You must be signed in to change notification settings - Fork 110
/
common.h
28 lines (23 loc) · 804 Bytes
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef COMMON_H
#define COMMON_H
#define ALIGN_TO(__n, __align) ({ \
typeof (__n) __ret; \
if ((__n) % (__align)) { \
__ret = ((__n) & (~((__align) - 1))) + (__align); \
} else __ret = (__n); \
__ret; \
})
#define UNUSED(__x) ((void)(__x))
#define MIN(x, y) ({ \
typeof (x) __x = (x); \
typeof (y) __y = (y); \
__x < __y ? __x : __y; \
})
#define STATIC_ASSERT(e) static char const static_assert[(e) ? 1 : -1] = {'!'}
#include <limits.h>
#if ULONG_MAX == 0xFFFFFFFF
#define __32BITS
#else
#define __64BITS
#endif
#endif