-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures.h
83 lines (70 loc) · 1.97 KB
/
features.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// __ .__ .___
// _____/ |_ | |__ ____ _____ __| _/
// _/ ___\ __\ ______| | \_/ __ \\__ \ / __ |
// \ \___| | /_____/| Y \ ___/ / __ \_/ /_/ |
// \___ >__| |___| /\___ >____ /\____ |
// \/ \/ \/ \/ \/
//
#pragma once
#if defined(CT_FEATURE_CHECKS) && !defined(CT_FEATURE_LOG)
#define CT_FEATURE_LOG 1
#endif
#if defined(CT_FEATURE_SSE) && !defined(__SSE__)
#undef CT_FEATURE_SSE 1
#endif
#if defined(CT_FEATURE_SSE) && defined(__SSE2__)
#define CT_FEATURE_SSE2 1
#endif
#if defined(CT_FEATURE_SSE) && defined(__SSE3__)
#define CT_FEATURE_SSE3 1
#endif
#if defined(CT_FEATURE_SSE) && defined(__SSE4_1__)
#define CT_FEATURE_SSE4 1
#endif
#if defined(CT_FEATURE_SSE) && defined(__AVX__)
#define CT_FEATURE_AVX 1
#endif
#if defined(CT_FEATURE_SSE) && defined(__AVX2__)
#define CT_FEATURE_AVX2 1
#endif
#ifdef CT_FEATURE_ANSI
#define CT_ANSI_RED "\x1b[31;1m"
#define CT_ANSI_GREEN "\x1b[32;1m"
#define CT_ANSI_YELLOW "\x1b[33;1m"
#define CT_ANSI_BLUE "\x1b[34;1m"
#define CT_ANSI_MAGENTA "\x1b[35;1m"
#define CT_ANSI_CYAN "\x1b[36;1m"
#define CT_ANSI_WHITE "\x1b[37;1m"
#define CT_ANSI_RESET "\x1b[0m"
#else
#define CT_ANSI_RED
#define CT_ANSI_GREEN
#define CT_ANSI_YELLOW
#define CT_ANSI_BLUE
#define CT_ANSI_MAGENTA
#define CT_ANSI_CYAN
#define CT_ANSI_WHITE
#define CT_ANSI_RESET
#endif
#if defined(__EMSCRIPTEN__) && !defined(CT_NO_EXPORT)
#define ct_export __attribute__((used))
#else
#define ct_export
#endif
#define ct_inline static inline
#ifdef __cplusplus
#define CT_BEGIN_DECLS extern "C" {
#define CT_END_DECLS }
#else
#define CT_BEGIN_DECLS
#define CT_END_DECLS
#endif
#if defined(__GNUC__) || defined(__clang__)
#define CT_LIKELY(x) (__builtin_expect(!!(x), 1))
#define CT_UNLIKELY(x) (__builtin_expect(!!(x), 0))
#define CT_UNPREDICTABLE(x) (__builtin_unpredictable(!!(x)))
#else
#define CT_LIKELY(x) (x)
#define CT_UNLIKELY(x) (x)
#define CT_UNPREDICTABLE(x) (x)
#endif