diff options
author | Jack Lloyd <[email protected]> | 2019-09-04 10:00:12 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-09-04 11:49:52 -0400 |
commit | 7e2356173973a1c9c3040ab5f59141f98430d8e4 (patch) | |
tree | 9d9951eb5665f0116a1bb5c5319effb9a742111c /src/lib | |
parent | 3a3a7b38160dbfd76fc0e073b23e7f35e480cbd9 (diff) |
Avoid dynamic endian dispatch if we don't need it
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/cpuid/cpuid.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/utils/cpuid/cpuid.h b/src/lib/utils/cpuid/cpuid.h index 256c6cc57..bb6af55a2 100644 --- a/src/lib/utils/cpuid/cpuid.h +++ b/src/lib/utils/cpuid/cpuid.h @@ -70,12 +70,24 @@ class BOTAN_PUBLIC_API(2,1) CPUID final static bool is_little_endian() { +#if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) + return true; +#elif defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) + return false; +#else return state().endian_status() == Endian_Status::Little; +#endif } static bool is_big_endian() { +#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) + return true; +#elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) + return false; +#else return state().endian_status() == Endian_Status::Big; +#endif } enum CPUID_bits : uint64_t { |