Skip to content

Commit 3d6ebda

Browse files
author
Julian LALU
committed
Hashset use sse2 group
Replace hud::check by HUD_CHECK Use C++23 Enable SSE2 and AVX2
1 parent 370f680 commit 3d6ebda

23 files changed

+619
-601
lines changed

interface/core/assert.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ namespace hud
1313
*/
1414
static constexpr void check([[maybe_unused]] const bool condition) noexcept
1515
{
16-
if (!hud::is_constant_evaluated())
16+
if consteval
17+
{
18+
}
19+
else
1720
{
1821
if constexpr (hud::compilation::is_assertion_enabled())
1922
{
@@ -24,7 +27,11 @@ namespace hud
2427
}
2528
}
2629
}
27-
2830
} // namespace hud
2931

32+
#if HUD_ASSERTION_ENABLED
33+
#define HUD_CHECK(condition) hud::check(condition);
34+
#else
35+
#define HUD_CHECK(condition)
36+
#endif
3037
#endif // HD_INC_CORE_ASSERT_H

interface/core/compilation.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
#define HD_INC_CORE_COMPILATION_H
33
#include "defines.h"
44

5+
#ifndef HUD_ASSERTION_ENABLED
6+
#if defined(HD_DEBUG) || defined(HD_DEBUGOPTIMIZED)
7+
#define HUD_ASSERTION_ENABLED 1
8+
#else
9+
#define HUD_ASSERTION_ENABLED 0
10+
#endif
11+
#endif
12+
513
namespace hud
614
{
715

@@ -174,11 +182,7 @@ namespace hud
174182
/** Retrieves if the assertion are enabled. */
175183
static constexpr bool is_assertion_enabled() noexcept
176184
{
177-
#if defined(HD_DEBUG) || defined(HD_DEBUGOPTIMIZED)
178-
return true;
179-
#else
180-
return false;
181-
#endif
185+
return HUD_ASSERTION_ENABLED == 1;
182186
}
183187

184188
/** Retrieves the endianness of scalar types. */

interface/core/compiler_defines.h

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ static_assert(sizeof(void *) == 8, "HD_TARGET_64_BITS is defined but size of poi
195195

196196
/** Detect SIMD
197197
- MSVC :
198+
// MSVC only defines macros for x86 32-bit code
199+
// All x86-64 processors support SSE2, so support can be assumed.
200+
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
198201
AVX-512 __AVX512F__
199202
AVX2 __AVX2__
200203
AVX __AVX__
@@ -207,24 +210,37 @@ AVX __AVX__
207210
SSE2 __SSE2__
208211
SSE __SSE__
209212
*/
213+
210214
#if defined(__AVX512F__)
211-
#define HD_AVX512
215+
#define HD_AVX512 1
216+
#else
217+
#define HD_AVX512 0
212218
#endif
213219
#if defined(__AVX2__)
214-
#define HD_AVX2
220+
#define HD_AVX2 1
221+
#else
222+
#define HD_AVX2 0
215223
#endif
216224
#if defined(__AVX__)
217-
#define HD_AVX
225+
#define HD_AVX 1
226+
#else
227+
#define HD_AVX 0
218228
#endif
219-
#if defined(__SSE__) || (_M_IX86_FP == 2)
220-
#define HD_SSE2
229+
#if defined(__SSE2__)
230+
#define HD_SSE2 1
231+
#else
232+
#define HD_SSE2 0
221233
#endif
222-
#if defined(__SSE__) || (_M_IX86_FP == 1)
223-
#define HD_SSE
234+
#if defined(__SSE__)
235+
#define HD_SSE 1
236+
#else
237+
#define HD_SSE 0
224238
#endif
225239

226-
// #if defined(__SSSE3__)
227-
// #define HD_SSSE3
228-
// #endif
240+
#if defined(__SSSE3__)
241+
#define HD_SSSE3 1
242+
#else
243+
#define HD_SSSE3 0
244+
#endif
229245

230246
#endif // HD_INC_CORE_COMPILER_DEFINES_H

0 commit comments

Comments
 (0)