82 #ifndef __W_WORKAROUND_H 86 #endif // __W_WORKAROUND_H 88 #define CAST(t, o) ((t)(o)) 92 #define W_IFDEBUG1(x) x 93 #define W_IFNDEBUG1(x) 96 #define W_IFNDEBUG1(x) x 100 #define W_IFDEBUG2(x) x 101 #define W_IFNDEBUG2(x) 103 #define W_IFDEBUG2(x) 104 #define W_IFNDEBUG2(x) x 107 #if W_DEBUG_LEVEL > 2 108 #define W_IFDEBUG3(x) x 109 #define W_IFNDEBUG3(x) 111 #define W_IFDEBUG3(x) 112 #define W_IFNDEBUG3(x) x 115 #if W_DEBUG_LEVEL > 3 116 #define W_IFDEBUG4(x) x 117 #define W_IFNDEBUG4(x) 119 #define W_IFDEBUG4(x) 120 #define W_IFNDEBUG4(x) x 123 #if W_DEBUG_LEVEL > 4 124 #define W_IFDEBUG5(x) x 125 #define W_IFNDEBUG5(x) 127 #define W_IFDEBUG5(x) 128 #define W_IFNDEBUG5(x) x 131 #define W_IFDEBUG9(x) 132 #define W_IFNDEBUG9(x) x 137 #if W_DEBUG_LEVEL == 1 138 #define W_IFDEBUG(x) W_IFDEBUG1(x) 139 #define W_IFNDEBUG(x) W_IFNDEBUG1(x) 142 #if W_DEBUG_LEVEL == 2 143 #define W_IFDEBUG(x) W_IFDEBUG2(x) 144 #define W_IFNDEBUG(x) W_IFNDEBUG2(x) 147 #if W_DEBUG_LEVEL == 3 148 #define W_IFDEBUG(x) W_IFDEBUG3(x) 149 #define W_IFNDEBUG(x) W_IFNDEBUG3(x) 152 #if W_DEBUG_LEVEL == 4 153 #define W_IFDEBUG(x) W_IFDEBUG4(x) 154 #define W_IFNDEBUG(x) W_IFNDEBUG4(x) 161 #define W_IFNDEBUG(x) x 167 #define W_IFTRACE(x) x 168 #define W_IFNTRACE(x) 171 #define W_IFNTRACE(x) x 175 #define w_assert0(x) do { \ 176 if (!(x)) w_base_t::assert_failed(#x, __FILE__, __LINE__); \ 179 #define w_assert0_msg(x, msg) \ 182 std::stringstream s; \ 184 s << " (detail: " << msg << ")"; \ 185 w_base_t::assert_failed(s.str().c_str(), __FILE__, __LINE__); \ 189 #ifndef W_DEBUG_LEVEL 190 #define W_DEBUG_LEVEL 0 194 #if W_DEBUG_LEVEL >= 1 195 #define w_assert1(x) w_assert0(x) 198 #define w_assert1(x) if (false) { (void)(x); } 202 #if W_DEBUG_LEVEL >= 2 203 #define w_assert2(x) w_assert1(x) 206 #define w_assert2(x) if (false) { (void)(x); } 210 #if W_DEBUG_LEVEL >= 3 211 #define w_assert3(x) w_assert1(x) 214 #define w_assert3(x) if (false) { (void)(x); } 218 #if W_DEBUG_LEVEL >= 4 219 #define w_assert4(x) w_assert1(x) 222 #define w_assert4(x) if (false) { (void)(x); } 226 #if W_DEBUG_LEVEL >= 5 227 #define w_assert5(x) w_assert1(x) 230 #define w_assert5(x) if (false) { (void)(x); } 243 #define w_assert9(x) if (false) { (void)(x); } 252 #define W_ENUM(x) ((int)(x)) 261 #define W_ADDR(x) ((void *)(x)) 289 #if defined(LARGEFILE_AWARE) || defined(ARCH_LP64) 325 #define alignonarg(a) (((ptrdiff_t)(a))-1) 326 #define alignon(p, a) (((ptrdiff_t)((ptrdiff_t)(p) + alignonarg(a))) & ~alignonarg(a)) 338 # define ALIGNON1 (ALIGNON-1) 339 # define ALIGN_BYTE(sz) ((size_t)((sz + ALIGNON1) & ~ALIGNON1)) 361 static int64_t
strtoi8(
const char*,
char** end = 0,
int base = 0);
369 static uint64_t
strtou8(
const char*,
char** end = 0,
int base = 0);
375 static bool is_nan(
const f8_t x);
387 static uint16_t
w_ntohs(uint16_t);
389 static uint16_t
w_htons(uint16_t);
391 static uint32_t
w_ntohl(uint32_t);
393 static uint32_t
w_htonl(uint32_t);
449 #ifdef WORDS_BIGENDIAN 514 #if W_DEBUG_LEVEL > 4 515 #define ASSERT_FITS_IN_LONGLONG(T) { \ 516 CompileTimeAssertion<sizeof(int64_t) >= sizeof(T)> assert__##T##__fits_in_longlong; \ 517 assert__##T##__fits_in_longlong.reference(); \ 519 #define ASSERT_FITS_IN_POINTER(T) { \ 520 CompileTimeAssertion<sizeof(void*) >= sizeof(T)> assert__##T##__fits_in_pointer; \ 521 assert__##T##__fits_in_pointer.reference(); \ 525 #define ASSERT_FITS_IN_POINTER(T) 526 #define ASSERT_FITS_IN_LONGLONG(T) Class that adds virtual destructor to w_base_t.
Definition: w_base.h:466
static uint32_t w_htonl(uint32_t)
Definition: w_base.cpp:261
static const int8_t int1_min
Definition: w_base.h:304
static void abort()
dump core
Definition: w_base.cpp:218
unsigned short u_short
Definition: w_base.h:273
static bool is_finite(const f8_t x)
Definition: w_base.cpp:183
static const uint32_t uint4_max
Definition: w_base.h:316
static const int32_t int4_min
Definition: w_base.h:308
static bool is_aligned(size_t sz)
Definition: w_base.h:434
static bool is_nan(const f8_t x)
Definition: w_base.cpp:201
CompareOp
Comparison Operators.
Definition: w_base.h:407
float f4_t
Definition: w_base.h:300
w_vbase_t()
Definition: w_base.h:468
Compile-time assertion trick.
Definition: w_base.h:507
static const uint32_t uint4_min
Definition: w_base.h:316
static const int64_t int8_min
Definition: w_base.h:310
int32_t base_stat_t
Definition: w_base.h:296
compile_time_assert()
Definition: w_base.h:508
static bool is_infinite_or_nan(const f8_t x)
Definition: w_base.cpp:212
static const uint64_t uint8_min
Definition: w_base.h:318
virtual ~w_vbase_t()
Definition: w_base.h:470
static const int32_t int4_max
Definition: w_base.h:308
float base_float_t
Definition: w_base.h:297
Return code for most functions and methods.
Definition: w_rc.h:87
static uint32_t w_ntohl(uint32_t)
Definition: w_base.cpp:257
void reference()
Definition: w_base.h:486
static const int8_t int1_max
Definition: w_base.h:304
static const int16_t int2_min
Definition: w_base.h:306
#define ALIGN_BYTE(sz)
Definition: w_base.h:339
static void assert_failed(const char *desc, const char *file, uint32_t line)
print a message and abort
Definition: w_base.cpp:124
unsigned long u_long
Definition: w_base.h:275
static const uint16_t uint2_min
Definition: w_base.h:314
unsigned char u_char
Definition: w_base.h:271
static const uint8_t uint1_min
Definition: w_base.h:312
static bool is_infinite(const f8_t x)
Definition: w_base.cpp:190
static bool is_big_endian()
Definition: w_base.h:448
static int64_t strtoi8(const char *, char **end=0, int base=0)
Convert string to 8-byte integer.
Definition: w_base.cpp:159
static uint16_t w_ntohs(uint16_t)
Definition: w_base.cpp:249
double f8_t
Definition: w_base.h:302
static bool is_little_endian()
Definition: w_base.h:460
static const uint16_t uint2_max
Definition: w_base.h:314
uint64_t large_stat_t
Definition: w_base.h:281
static uint64_t strtou8(const char *, char **end=0, int base=0)
Convert string to 8-byte unsigned integer.
Definition: w_base.cpp:172
static const uint8_t uint1_max
Definition: w_base.h:312
static uint16_t w_htons(uint16_t)
Definition: w_base.cpp:253
static const int16_t int2_max
Definition: w_base.h:306
#define T
Definition: w_okvl_inl.h:45
static const uint64_t uint8_max
Definition: w_base.h:318
static const int64_t int8_max
Definition: w_base.h:310