Browse Source

public: build: reorder enums by probability, rename ARCHITECTURE_ ABI macros to just ARCH_ for easier matching

pull/2/head
Alibek Omarov 2 years ago
parent
commit
e9da3e2976
  1. 10
      public/build.c
  2. 32
      public/buildenums.h

10
public/build.c

@ -164,8 +164,8 @@ const char *Q_ArchitectureStringByID( const int arch, const uint abi, const int
// no support for big endian ARM here // no support for big endian ARM here
if( endianness == ENDIANNESS_LITTLE ) if( endianness == ENDIANNESS_LITTLE )
{ {
const int ver = ( abi >> ARCHITECTURE_ARM_VER_SHIFT ) & ARCHITECTURE_ARM_VER_MASK; const uint ver = ( abi >> ARCH_ARM_VER_SHIFT ) & ARCH_ARM_VER_MASK;
const qboolean hardfp = FBitSet( abi, ARCHITECTURE_ARM_HARDFP ); const qboolean hardfp = FBitSet( abi, ARCH_ARM_HARDFP );
if( is64 ) if( is64 )
return "arm64"; // keep as arm64, it's not aarch64! return "arm64"; // keep as arm64, it's not aarch64!
@ -188,11 +188,11 @@ const char *Q_ArchitectureStringByID( const int arch, const uint abi, const int
case ARCHITECTURE_RISCV: case ARCHITECTURE_RISCV:
switch( abi ) switch( abi )
{ {
case ARCHITECTURE_RISCV_FP_SOFT: case ARCH_RISCV_FP_SOFT:
return is64 ? "riscv64" : "riscv32"; return is64 ? "riscv64" : "riscv32";
case ARCHITECTURE_RISCV_FP_SINGLE: case ARCH_RISCV_FP_SINGLE:
return is64 ? "riscv64f" : "riscv32f"; return is64 ? "riscv64f" : "riscv32f";
case ARCHITECTURE_RISCV_FP_DOUBLE: case ARCH_RISCV_FP_DOUBLE:
return is64 ? "riscv64d" : "riscv64f"; return is64 ? "riscv64d" : "riscv64f";
} }
break; break;

32
public/buildenums.h

@ -28,10 +28,10 @@ GNU General Public License for more details.
// //
//================================================================ //================================================================
#define PLATFORM_WIN32 1 #define PLATFORM_WIN32 1
#define PLATFORM_ANDROID 2 #define PLATFORM_LINUX 2
#define PLATFORM_LINUX 3 #define PLATFORM_FREEBSD 3
#define PLATFORM_APPLE 4 #define PLATFORM_ANDROID 4
#define PLATFORM_FREEBSD 5 #define PLATFORM_APPLE 5
#define PLATFORM_NETBSD 6 #define PLATFORM_NETBSD 6
#define PLATFORM_OPENBSD 7 #define PLATFORM_OPENBSD 7
#define PLATFORM_EMSCRIPTEN 8 #define PLATFORM_EMSCRIPTEN 8
@ -82,8 +82,8 @@ GNU General Public License for more details.
// CPU ARCHITECTURE DEFINES // CPU ARCHITECTURE DEFINES
// //
//================================================================ //================================================================
#define ARCHITECTURE_AMD64 1 #define ARCHITECTURE_X86 1
#define ARCHITECTURE_X86 2 #define ARCHITECTURE_AMD64 2
#define ARCHITECTURE_ARM 3 #define ARCHITECTURE_ARM 3
#define ARCHITECTURE_MIPS 4 #define ARCHITECTURE_MIPS 4
#define ARCHITECTURE_JS 6 #define ARCHITECTURE_JS 6
@ -131,27 +131,27 @@ GNU General Public License for more details.
//================================================================ //================================================================
#define BIT( n ) ( 1U << ( n )) #define BIT( n ) ( 1U << ( n ))
#define ARCHITECTURE_ARM_VER_MASK ( BIT( 5 ) - 1 ) #define ARCH_ARM_VER_MASK ( BIT( 5 ) - 1 )
#define ARCHITECTURE_ARM_VER_SHIFT 0 #define ARCH_ARM_VER_SHIFT 0
#define ARCHITECTURE_ARM_HARDFP BIT( 5 ) #define ARCH_ARM_HARDFP BIT( 5 )
#define ARCHITECTURE_RISCV_FP_SOFT 0 #define ARCH_RISCV_FP_SOFT 0
#define ARCHITECTURE_RISCV_FP_SINGLE 1 #define ARCH_RISCV_FP_SINGLE 1
#define ARCHITECTURE_RISCV_FP_DOUBLE 2 #define ARCH_RISCV_FP_DOUBLE 2
#if XASH_ARCHITECTURE == ARCHITECTURE_ARM #if XASH_ARCHITECTURE == ARCHITECTURE_ARM
#if XASH_ARM_HARDFP #if XASH_ARM_HARDFP
#define XASH_ARCHITECTURE_ABI ( ARCHITECTURE_ARM_HARDFP | XASH_ARM ) #define XASH_ARCHITECTURE_ABI ( ARCH_ARM_HARDFP | XASH_ARM )
#else #else
#define XASH_ARCHITECTURE_ABI ( XASH_ARM ) #define XASH_ARCHITECTURE_ABI ( XASH_ARM )
#endif #endif
#elif XASH_ARCHITECTURE == ARCHITECTURE_RISCV #elif XASH_ARCHITECTURE == ARCHITECTURE_RISCV
#if XASH_RISCV_SOFTFP #if XASH_RISCV_SOFTFP
#define XASH_ARCHITECTURE_ABI ARCHITECTURE_RISCV_FP_SOFT #define XASH_ARCHITECTURE_ABI ARCH_RISCV_FP_SOFT
#elif XASH_RISCV_SINGLEFP #elif XASH_RISCV_SINGLEFP
#define XASH_ARCHITECTURE_ABI ARCHITECTURE_RISCV_FP_SINGLE #define XASH_ARCHITECTURE_ABI ARCH_RISCV_FP_SINGLE
#elif XASH_RISCV_DOUBLEFP #elif XASH_RISCV_DOUBLEFP
#define XASH_ARCHITECTURE_ABI ARCHITECTURE_RISCV_FP_DOUBLE #define XASH_ARCHITECTURE_ABI ARCH_RISCV_FP_DOUBLE
#else #else
#error #error
#endif #endif

Loading…
Cancel
Save