Derive-C
Loading...
Searching...
No Matches
core.h
Go to the documentation of this file.
1
#pragma once
2
#include <stdlib.h>
3
4
#define NAME_EXPANDED(pre, post) pre##_##post
5
#define NAME(pre, post) NAME_EXPANDED(pre, post)
6
7
#define LIKELY(x) __builtin_expect(!!(x), 1)
8
9
#define MAYBE_NULL(T) T*
10
#define NEVER_NULL(T) T*
11
12
#define OUT(ptr) ptr
13
#define IN(ptr) ptr
14
#define INOUT(ptr) ptr
15
16
#define EXPAND(...) __VA_ARGS__
17
18
typedef
struct
{
19
#ifdef __cplusplus
20
char
_dummy_cpp_object_size_compatibility __attribute__((unused));
21
#endif
22
}
gdb_marker
;
23
24
static
inline
size_t
next_power_of_2
(
size_t
x) {
25
if
(x == 0)
26
return
1;
27
x--;
28
x |= x >> 1;
29
x |= x >> 2;
30
x |= x >> 4;
31
x |= x >> 8;
32
x |= x >> 16;
33
#if SIZE_MAX > 0xFFFFFFFF
34
x |= x >> 32;
// For 64-bit platforms
35
#endif
36
return
x + 1;
37
}
38
39
#define FORCE_INLINE inline __attribute__((always_inline))
next_power_of_2
static size_t next_power_of_2(size_t x)
Definition
core.h:24
gdb_marker
Definition
core.h:18
src
derive-c
core.h
Generated by
1.13.2