O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
private_prepro.h
1#pragma once
2
3/* Version for gcc < 8 or clang < 12, using a GNU extension */
4// #define O2SPP_ARGCNT1(...) O2SPP_ARGCNT2(IGNORED, ##__VA_ARGS__, O2SPP_ARGCNT4)
5// #define O2SPP_ARGCNT4 39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
6
7#define O2SPP_ARGCNT1(...) O2SPP_ARGCNT2(__VA_ARGS__ __VA_OPT__(,) O2SPP_ARGCNT4)
8#define O2SPP_ARGCNT2(...) O2SPP_ARGCNT3(__VA_ARGS__)
9#define O2SPP_ARGCNT3(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN, n, ...) n
10#define O2SPP_ARGCNT4 40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
11
12#define FNV1A_N(...) \
13 LIBO2S_PREPRO_CONCAT(FNV1A_, LIBO2S_PREPRO_ARGUMENT_COUNT(__VA_ARGS__))(__VA_ARGS__)
14
15#define FNV1A_F 16777619U
16#define FNV1A_0() 2166136261U
17#define FNV1A_1(A) ((A ^ FNV1A_0()) * FNV1A_F)
18
19#define FNV1A_2(AA,AB) \
20 ((AB ^ FNV1A_1(AA)) * FNV1A_F)
21#define FNV1A_3(AA,AB,AC) \
22 ((AC ^ FNV1A_2(AA,AB)) * FNV1A_F)
23#define FNV1A_4(AA,AB,AC,AD) \
24 ((AD ^ FNV1A_3(AA,AB,AC)) * FNV1A_F)
25#define FNV1A_5(AA,AB,AC,AD,AE) \
26 ((AE ^ FNV1A_4(AA,AB,AC,AD)) * FNV1A_F)
27#define FNV1A_6(AA,AB,AC,AD,AE,AF) \
28 ((AF ^ FNV1A_5(AA,AB,AC,AD,AE)) * FNV1A_F)
29#define FNV1A_7(AA,AB,AC,AD,AE,AF,AG) \
30 ((AG ^ FNV1A_6(AA,AB,AC,AD,AE,AF)) * FNV1A_F)
31#define FNV1A_8(AA,AB,AC,AD,AE,AF,AG,AH) \
32 ((AH ^ FNV1A_7(AA,AB,AC,AD,AE,AF,AG)) * FNV1A_F)
33#define FNV1A_9(AA,AB,AC,AD,AE,AF,AG,AH,AI) \
34 ((AI ^ FNV1A_8(AA,AB,AC,AD,AE,AF,AG,AH)) * FNV1A_F)
35#define FNV1A_10(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ) \
36 ((AJ ^ FNV1A_9(AA,AB,AC,AD,AE,AF,AG,AH,AI)) * FNV1A_F)
37#define FNV1A_11(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK) \
38 ((AK ^ FNV1A_10(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ)) * FNV1A_F)
39#define FNV1A_12(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL) \
40 ((AL ^ FNV1A_11(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK)) * FNV1A_F)
41#define FNV1A_13(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM) \
42 ((AM ^ FNV1A_12(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL)) * FNV1A_F)
43#define FNV1A_14(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN) \
44 ((AN ^ FNV1A_13(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM)) * FNV1A_F)
45#define FNV1A_15(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO) \
46 ((AO ^ FNV1A_14(AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN)) * FNV1A_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