diff options
author | Jack Lloyd <[email protected]> | 2016-11-26 12:19:26 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-26 12:34:15 -0500 |
commit | 69ebd4d2b02fba98747e0c16829d47b2f05760ea (patch) | |
tree | aa7e9724eacd918e56433686e9ab0c06c39ea3ec /src/lib/utils/loadstor.h | |
parent | 3bc46d79c4509cbf871f762e39a366e95e8342ce (diff) |
Add compiler.h macro header extracted from build.h
All this is just standard C that the user should not touch, so it doesn't
really make sense to have it in the build.h template file.
Remove BOTAN_TARGET_CPU_HAS_KNOWN_ENDIANESS - only used twice (in loadstor.h)
and that code is clearer without it.
Diffstat (limited to 'src/lib/utils/loadstor.h')
-rw-r--r-- | src/lib/utils/loadstor.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h index 9ae9fda0e..15ff6a708 100644 --- a/src/lib/utils/loadstor.h +++ b/src/lib/utils/loadstor.h @@ -324,10 +324,10 @@ inline void load_le(T out[], { if(count > 0) { -#if defined(BOTAN_TARGET_CPU_HAS_KNOWN_ENDIANNESS) +#if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) + std::memcpy(out, in, sizeof(T)*count); +#elif defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) std::memcpy(out, in, sizeof(T)*count); - -#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) const size_t blocks = count - (count % 4); const size_t left = count - blocks; @@ -336,8 +336,6 @@ inline void load_le(T out[], for(size_t i = 0; i != left; ++i) out[blocks+i] = reverse_bytes(out[blocks+i]); -#endif - #else for(size_t i = 0; i != count; ++i) out[i] = load_le<T>(in, i); @@ -416,10 +414,10 @@ inline void load_be(T out[], { if(count > 0) { -#if defined(BOTAN_TARGET_CPU_HAS_KNOWN_ENDIANNESS) +#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) + std::memcpy(out, in, sizeof(T)*count); +#elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) std::memcpy(out, in, sizeof(T)*count); - -#if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) const size_t blocks = count - (count % 4); const size_t left = count - blocks; @@ -428,8 +426,6 @@ inline void load_be(T out[], for(size_t i = 0; i != left; ++i) out[blocks+i] = reverse_bytes(out[blocks+i]); -#endif - #else for(size_t i = 0; i != count; ++i) out[i] = load_be<T>(in, i); |