check for __GNUC__ instead of just assuming it

This commit is contained in:
toxieainc 2022-07-17 20:23:11 +02:00
parent abb1273aa0
commit c42a2d8951
3 changed files with 5 additions and 5 deletions

View file

@ -60,7 +60,7 @@
#ifndef stricmp #ifndef stricmp
#ifdef _MSC_VER // MS VisualC++ #ifdef _MSC_VER // MS VisualC++
#define stricmp _stricmp #define stricmp _stricmp
#else // Assume GC #elif defined(__GNUC__)
#define stricmp strcasecmp #define stricmp strcasecmp
#endif // _MSC_VER #endif // _MSC_VER
#endif // stricmp #endif // stricmp

View file

@ -54,14 +54,14 @@
// stricmp() is non-standard, apparently... // stricmp() is non-standard, apparently...
#ifdef _MSC_VER // MS VisualC++ #ifdef _MSC_VER // MS VisualC++
#define stricmp _stricmp #define stricmp _stricmp
#else // assume GCC #elif defined(__GNUC__)
#define stricmp strcasecmp #define stricmp strcasecmp
#endif #endif
// 32-bit rotate left // 32-bit rotate left
#ifdef _MSC_VER // MS VisualC++ - use VS intrinsic function _rotl #ifdef _MSC_VER // MS VisualC++ - use VS intrinsic function _rotl
#define rotl(val, shift) val = _rotl(val, shift) #define rotl(val, shift) val = _rotl(val, shift)
#else // Otherwise assume GCC which should optimise following to asm #elif defined(__GNUC__) // GCC should optimise following to asm
#define rotl(val, shift) val = (val>>shift)|(val<<(32-shift)) #define rotl(val, shift) val = (val>>shift)|(val<<(32-shift))
#endif #endif

View file

@ -11,7 +11,7 @@ namespace Util
uint16_t * const buffer16 = (uint16_t*)buffer; uint16_t * const buffer16 = (uint16_t*)buffer;
for (size_t i = 0; i < size/2; i++) for (size_t i = 0; i < size/2; i++)
buffer16[i] = _byteswap_ushort(buffer16[i]); buffer16[i] = _byteswap_ushort(buffer16[i]);
#elif 1 // assume GCC #elif defined(__GNUC__)
uint16_t * const buffer16 = (uint16_t*)buffer; uint16_t * const buffer16 = (uint16_t*)buffer;
for (size_t i = 0; i < size/2; i++) for (size_t i = 0; i < size/2; i++)
buffer16[i] = __builtin_bswap16(buffer16[i]); buffer16[i] = __builtin_bswap16(buffer16[i]);
@ -31,7 +31,7 @@ namespace Util
uint32_t * const buffer32 = (uint32_t*)buffer; uint32_t * const buffer32 = (uint32_t*)buffer;
for (size_t i = 0; i < size/4; i++) for (size_t i = 0; i < size/4; i++)
buffer32[i] = _byteswap_ulong(buffer32[i]); buffer32[i] = _byteswap_ulong(buffer32[i]);
#elif 1 // assume GCC #elif defined(__GNUC__)
uint32_t * const buffer32 = (uint32_t*)buffer; uint32_t * const buffer32 = (uint32_t*)buffer;
for (size_t i = 0; i < size/4; i++) for (size_t i = 0; i < size/4; i++)
buffer32[i] = __builtin_bswap32(buffer32[i]); buffer32[i] = __builtin_bswap32(buffer32[i]);