O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
preprocessing.h
Go to the documentation of this file.
1#pragma once
2
3/* ************************************************************************** */
4/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
5/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
6/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
7/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
8/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
9/* */
16/* ************************************************************************** */
17
18#include "o2s/private_prepro.h"
19
22
24#define LIBO2S_PREPRO_STRING_DIRECT(TEXT) #TEXT
25
27#define LIBO2S_PREPRO_STRING(EXPRESSION) LIBO2S_PREPRO_STRING_DIRECT(EXPRESSION)
28
30#define LIBO2S_PREPRO_CONCAT_DIRECT(TEXT1, TEXT2) TEXT1 ## TEXT2
31
36#define LIBO2S_PREPRO_CONCAT(EXPRESSION1, EXPRESSION2) LIBO2S_PREPRO_CONCAT_DIRECT(EXPRESSION1, EXPRESSION2)
37
39
42
44#define max(a, b) \
45 ({ \
46 __typeof__(a) _a = (a); \
47 __typeof__(b) _b = (b); \
48 _a > _b ? _a : _b; \
49 })
50
52#define min(a, b) \
53 ({ \
54 __typeof__(a) _a = (a); \
55 __typeof__(b) _b = (b); \
56 _a < _b ? _a : _b; \
57 })
58
60
62#define C_ARRAY_LENGTH(ARRAY) (sizeof(ARRAY) / sizeof(*ARRAY))
63
65#define LIBO2S_PREPRO_ARGUMENT_COUNT(...) O2SPP_ARGCNT1(__VA_ARGS__)
66
72#define FNV1A(...) FNV1A_N(__VA_ARGS__)