Remove BitCountInit and handle that with static initialization

This commit is contained in:
ζeh Matt 2023-06-27 22:45:19 +03:00
parent a83337b2da
commit 873fff2513
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
3 changed files with 1 additions and 8 deletions

View File

@ -48,7 +48,6 @@ namespace Platform
Platform::AndroidInitClassLoader(); Platform::AndroidInitClassLoader();
#endif // __ANDROID__ #endif // __ANDROID__
BitCountInit();
MaskInit(); MaskInit();
} }
} }

View File

@ -204,12 +204,7 @@ static int32_t BitCountLut(uint32_t source)
+ BitsSetTable256[source >> 24]; + BitsSetTable256[source >> 24];
} }
static int32_t (*BitCountFn)(uint32_t); static const auto BitCountFn = BitCountPopcntAvailable() ? BitCountPopcnt : BitCountLut;
void BitCountInit()
{
BitCountFn = BitCountPopcntAvailable() ? BitCountPopcnt : BitCountLut;
}
int32_t BitCount(uint32_t source) int32_t BitCount(uint32_t source)
{ {

View File

@ -28,7 +28,6 @@ bool AVX2Available();
int32_t UtilBitScanForward(int32_t source); int32_t UtilBitScanForward(int32_t source);
int32_t UtilBitScanForward(int64_t source); int32_t UtilBitScanForward(int64_t source);
void BitCountInit();
int32_t BitCount(uint32_t source); int32_t BitCount(uint32_t source);
int32_t StrLogicalCmp(char const* a, char const* b); int32_t StrLogicalCmp(char const* a, char const* b);
char* SafeStrCpy(char* destination, const char* source, size_t num); char* SafeStrCpy(char* destination, const char* source, size_t num);