diff options
author | Jack Lloyd <[email protected]> | 2016-11-07 11:36:29 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-07 11:43:27 -0500 |
commit | 523b2a4ca48fa5cf04ea371aabe7167ce2e5cd13 (patch) | |
tree | c9a8b736d1f7d5dfb2a0d6b31142bdf621bf1103 /src/lib/utils/cpuid.h | |
parent | cdadd7c77bf761e28249e7f195862082bf9e5c64 (diff) |
Add CPUID::is_little_endian
Having a runtime endian test to verify against the build setting is
useful.
Diffstat (limited to 'src/lib/utils/cpuid.h')
-rw-r--r-- | src/lib/utils/cpuid.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/utils/cpuid.h b/src/lib/utils/cpuid.h index 53e59e9e5..aa7bae963 100644 --- a/src/lib/utils/cpuid.h +++ b/src/lib/utils/cpuid.h @@ -42,6 +42,15 @@ class BOTAN_DLL CPUID return g_cache_line_size; } + static bool is_little_endian() + { + if(!g_initialized) + { + initialize(); + } + return g_little_endian; + } + enum CPUID_bits { #if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) // This matches the layout of cpuid(1) @@ -184,6 +193,7 @@ class BOTAN_DLL CPUID private: static bool g_initialized; + static bool g_little_endian; static size_t g_cache_line_size; static u64bit g_processor_flags[2]; }; |