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