16 #ifndef INCLUDE_NN_NLIB_PLATFORM_CTR_H_ 17 #define INCLUDE_NN_NLIB_PLATFORM_CTR_H_ 18 #ifndef INCLUDE_NN_NLIB_PLATFORM_H_ 19 # error do not include directly 22 #ifdef NN_PLATFORM_CTR 25 #ifndef __STDC_LIMIT_MACROS 26 #define __STDC_LIMIT_MACROS 28 #ifndef __STDC_CONSTANT_MACROS 29 #define __STDC_CONSTANT_MACROS 33 #ifndef __USE_C99_MATH 34 # define __USE_C99_MATH 43 #define NLIB_ALWAYS_INLINE __forceinline 44 #define NLIB_NEVER_INLINE __declspec(noinline) 48 #define NLIB_LIKELY(x) __builtin_expect(!!(x), 1) 49 #define NLIB_UNLIKELY(x) __builtin_expect(!!(x), 0) 50 #define NLIB_EXPECT(var, exp_value) __builtin_expect((var), (exp_value)) 51 #define NLIB_CHECK_RESULT 52 #define NLIB_NORETURN __attribute__((noreturn)) 53 #define NLIB_NONNULL __attribute__((nonnull)) 54 #define NLIB_NONNULL_1 __attribute__((nonnull (1))) 55 #define NLIB_NONNULL_2 __attribute__((nonnull (2))) 56 #define NLIB_NONNULL_3 __attribute__((nonnull (3))) 57 #define NLIB_NONNULL_4 __attribute__((nonnull (4))) 58 #define NLIB_NONNULL_5 __attribute__((nonnull (5))) 59 #define NLIB_NONNULL_ENABLED 60 #define NLIB_ATTRIBUTE_MALLOC __attribute__((malloc)) 61 #define NLIB_ATTRIBUTE_PURE __attribute__((pure)) 62 #define NLIB_ATTRIBUTE_CONST __attribute__((const)) 63 #define NLIB_ATTRIBUTE_ALLOC_SIZE1(n) 64 #define NLIB_ATTRIBUTE_ALLOC_SIZE2(n0, n1) 65 #define NLIB_ATTRIBUTE_ALLOC_ALIGN(algn) 66 #define NLIB_ATTRIBUTE_ASSUME_ALIGNED(n) 67 #ifndef NLIB_DEPRECATED 68 #define NLIB_DEPRECATED 70 #ifndef NLIB_DEPRECATED_MSG 71 #define NLIB_DEPRECATED_MSG(msg) 73 #define NLIB_VIS_HIDDEN 74 #define NLIB_VIS_PUBLIC 75 #define NLIB_WEAKSYMBOL __attribute__((weak)) 76 #define NLIB_LITTLE_ENDIAN 78 void nlib_ctr_barrier(
void);
79 #define NLIB_MEMORY_ORDER_RELEASE nlib_ctr_barrier() 80 #define NLIB_MEMORY_ORDER_ACQUIRE nlib_ctr_barrier() 81 #define NLIB_MEMORY_ORDER_ACQ_REL nlib_ctr_barrier() 82 #define NLIB_MEMORY_ORDER_SEQ_CST nlib_ctr_barrier() 90 #define NLIB_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL } 91 #define NLIB_RECURSIVE_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL } 92 #define NLIB_RECURSIVE_TIMED_MUTEX_INITIALIZER { 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL } 96 struct nlib_semaphore_ {
105 #define NLIB_COND_INITIALIZER {0} 107 __declspec(noreturn)
int MyNoreturn_(
void);
108 #define NLIB_ASSUME(cond) (void)((cond) || MyNoreturn_()) 110 #define NLIB_LIBC_nlib_memcmp 112 #define NLIB_ATOMIC_RELAXED (0) 113 #define NLIB_ATOMIC_ACQUIRE (1) 114 #define NLIB_ATOMIC_RELEASE (2) 115 #define NLIB_ATOMIC_ACQ_REL (3) 116 #define NLIB_ATOMIC_SEQ_CST (7) 122 int32_t desired,
int weak,
123 int success_memorder,
int failure_memorder);
139 int64_t desired,
int weak,
140 int success_memorder,
int failure_memorder);
159 void* desired,
int weak,
160 int success_memorder,
int failure_memorder);
167 #define NLIB_FD_O_RDONLY (0x0000) 168 #define NLIB_FD_O_WRONLY (0x0001) 169 #define NLIB_FD_O_RDWR (0x0002) 170 #define NLIB_FD_O_APPEND (0x0008) 171 #define NLIB_FD_O_CREAT (0x0100) 172 #define NLIB_FD_O_TRUNC (0x0200) 173 #define NLIB_FD_O_EXCL (0x0400) 179 #define NLIB_NOEXCEPT 180 #ifndef NLIB_HAS_ZLIB 181 # define NLIB_HAS_ZLIB 185 #endif // INCLUDE_NN_NLIB_PLATFORM_CTR_H_