SyterKit
0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
include
arch
arm32
stddef.h
Go to the documentation of this file.
1
#ifndef __STDDEF_H__
2
#define __STDDEF_H__
3
4
#ifdef __cplusplus
5
extern
"C"
{
6
#endif
7
8
#if defined(__cplusplus)
9
#define NULL (0)
10
#else
11
#define NULL ((void *) 0)
12
#endif
13
14
#if (defined(__GNUC__) && (__GNUC__ >= 4))
15
#define offsetof(type, member) __builtin_offsetof(type, member)
16
#else
17
#define offsetof(type, field) ((size_t) (&((type *) 0)->field))
18
#endif
19
#define container_of(ptr, type, member) \
20
({ \
21
const typeof(((type *) 0)->member) *__mptr = (ptr); \
22
(type *) ((char *) __mptr - offsetof(type, member)); \
23
})
24
25
#if (defined(__GNUC__) && (__GNUC__ >= 3))
26
#define likely(expr) (__builtin_expect(!!(expr), 1))
27
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
28
#else
29
#define likely(expr) (!!(expr))
30
#define unlikely(expr) (!!(expr))
31
#endif
32
33
#define min(a, b) (((a) < (b)) ? (a) : (b))
34
#define max(a, b) (((a) > (b)) ? (a) : (b))
35
36
#define clamp(v, a, b) min(max(a, v), b)
37
38
#define ifloor(x) ((x) > 0 ? (int) (x) : (int) ((x) -0.9999999999))
39
#define iround(x) ((x) > 0 ? (int) ((x) + 0.5) : (int) ((x) -0.5))
40
#define iceil(x) ((x) > 0 ? (int) ((x) + 0.9999999999) : (int) (x))
41
#define idiv255(x) ((((int) (x) + 1) * 257) >> 16)
42
43
#ifdef __cplusplus
44
}
45
#endif
46
47
#endif
/* __STDDEF_H__ */
Generated by
1.9.8