Skip to content

Commit 299208d

Browse files
committed
Moved COMPILE_ASSERT, OFFSETOF, NUMBEROF
1 parent de4f40d commit 299208d

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
#pragma once
22

3+
#ifndef COMPILE_ASSERT
4+
#define COMPILE_ASSERT(EXPRESSION) typedef char __static_assert_t[(EXPRESSION) ? 1 : -1]
5+
//#define COMPILE_ASSERT(EXPR) static_assert((EXPR), #EXPR)
6+
#endif // COMPILE_ASSERT
7+
8+
#ifndef OFFSETOF
9+
#define OFFSETOF(STRUCT, MEMBER) __builtin_offsetof(STRUCT, MEMBER)
10+
#endif // OFFSETOF
11+
12+
#ifndef NUMBEROF
13+
#define NUMBEROF(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
14+
#endif // NUMBEROF
315

game/source/_force_includes/_force_included_macros.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#define XCONCAT(x, y) x ## y
1010
#define CONCAT(x, y) XCONCAT(x, y)
1111

12-
#define OFFSETOF(s,m) __builtin_offsetof(s,m)
13-
#define NUMBEROF(_array) (sizeof(_array) / sizeof(_array[0]))
1412
#define IN_RANGE(value, begin, end) ((value) > (begin) && (value) < (end))
1513
#define IN_RANGE_INCLUSIVE(value, begin, end) ((value) >= (begin) && (value) <= (end))
1614
#define VALID_INDEX(index, count) ((index) >= 0 && (index) < (count))

game/source/cseries/cseries.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ constexpr bool pointer_is_aligned(void* pointer, int32 alignment_bits)
175175
return ((uns32)pointer & ((1 << alignment_bits) - 1)) == 0;
176176
}
177177

178-
#define COMPILE_ASSERT(EXPR) static_assert(EXPR, #EXPR)
179-
180178
#if defined(_DEBUG)
181179

182180
#define ASSERT(STATEMENT, ...) do { if (!(STATEMENT)) ASSERT_EXCEPTION(STATEMENT, true, __VA_ARGS__); } while (false)

0 commit comments

Comments
 (0)