-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathcommon.h
More file actions
25 lines (20 loc) · 791 Bytes
/
common.h
File metadata and controls
25 lines (20 loc) · 791 Bytes
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
#pragma once
/* Compiler hints */
#define ALWAYS_INLINE __attribute__((always_inline))
#define INIT_FUNCTION __attribute__((constructor))
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
/* Hardware hints */
#define PREFETCH_FOR_READ(ptr) __builtin_prefetch((ptr), 0, 3)
#define PREFETCH_FOR_WRITE(ptr) __builtin_prefetch((ptr), 1, 3)
#define ALIGNED(x) __attribute__((__aligned__(x)))
#define MIN(a, b) \
({ \
__typeof__(a) tmp_a = (a); \
__typeof__(b) tmp_b = (b); \
tmp_a < tmp_b ? tmp_a : tmp_b; \
})
#if __SIZEOF_POINTER__ == 4
typedef unsigned long long ptrpair_t; /* assume 64 bits */
#else /* __SIZEOF_POINTER__ == 8 */
typedef __int128 ptrpair_t;
#endif