3 #ifndef INCLUDE_NN_NLIB_PLATFORM_CTR_H_
4 #define INCLUDE_NN_NLIB_PLATFORM_CTR_H_
5 #ifndef INCLUDE_NN_NLIB_PLATFORM_H_
6 # error do not include directly
11 #define NLIB_HAS_STDHEADER_STDINT
12 #define NLIB_HAS_STDHEADER_INTTYPES
14 #ifndef __USE_C99_MATH
15 # define __USE_C99_MATH
24 #define NLIB_ALWAYS_INLINE __forceinline
25 #define NLIB_NEVER_INLINE __declspec(noinline)
29 #define NLIB_LIKELY(x) __builtin_expect(!!(x), 1)
30 #define NLIB_UNLIKELY(x) __builtin_expect(!!(x), 0)
31 #define NLIB_EXPECT(var, exp_value) __builtin_expect((var), (exp_value))
32 #define NLIB_CHECK_RESULT
33 #define NLIB_NORETURN __attribute__((noreturn))
34 #define NLIB_NONNULL __attribute__((nonnull))
35 #define NLIB_NONNULL_1 __attribute__((nonnull (1)))
36 #define NLIB_NONNULL_2 __attribute__((nonnull (2)))
37 #define NLIB_NONNULL_3 __attribute__((nonnull (3)))
38 #define NLIB_NONNULL_4 __attribute__((nonnull (4)))
39 #define NLIB_NONNULL_5 __attribute__((nonnull (5)))
40 #define NLIB_NONNULL_ENABLED
41 #define NLIB_ATTRIBUTE_MALLOC __attribute__((malloc))
42 #define NLIB_ATTRIBUTE_ALLOC_SIZE1(n)
43 #define NLIB_ATTRIBUTE_ALLOC_SIZE2(n0, n1)
44 #define NLIB_ATTRIBUTE_ALLOC_ALIGN(algn)
45 #define NLIB_ATTRIBUTE_ASSUME_ALIGNED(n)
46 #define NLIB_DEPRECATED
47 #define NLIB_DEPRECATED_MSG(msg)
48 #define NLIB_VIS_HIDDEN
49 #define NLIB_VIS_PUBLIC
50 #define NLIB_WEAKSYMBOL __attribute__((weak))
51 #define _Printf_format_string_
52 #define NLIB_LITTLE_ENDIAN
54 void nlib_ctr_barrier(
void);
55 #define NLIB_MEMORY_ORDER_RELEASE nlib_ctr_barrier()
56 #define NLIB_MEMORY_ORDER_ACQUIRE nlib_ctr_barrier()
57 #define NLIB_MEMORY_ORDER_ACQ_REL nlib_ctr_barrier()
63 #define NLIB_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL }
64 #define NLIB_RECURSIVE_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL }
65 #define NLIB_RECURSIVE_TIMED_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL }
69 struct nlib_semaphore_ {
78 #define NLIB_COND_INITIALIZER {0}
80 __declspec(noreturn) int MyNoreturn_(
void);
81 #define NLIB_ASSUME(cond) (void)((cond) || MyNoreturn_())
85 return x != 0 ? __builtin_clzll(x) : 64;
95 return x != 0 ? __builtin_clz(x) : 32;
103 #define NLIB_ATOMIC_RELAXED (0)
104 #define NLIB_ATOMIC_ACQUIRE (1)
105 #define NLIB_ATOMIC_RELEASE (2)
106 #define NLIB_ATOMIC_ACQ_REL (3)
107 #define NLIB_ATOMIC_SEQ_CST (7)
113 int32_t desired,
int weak,
114 int success_memorder,
int failure_memorder);
130 int64_t desired,
int weak,
131 int success_memorder,
int failure_memorder);
146 void* desired,
int weak,
147 int success_memorder,
int failure_memorder);
158 #define NLIB_NOEXCEPT
161 #endif // INCLUDE_NN_NLIB_PLATFORM_CTR_H_