From 69ebd4d2b02fba98747e0c16829d47b2f05760ea Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 26 Nov 2016 12:19:26 -0500 Subject: 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. --- src/lib/utils/loadstor.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/lib/utils/loadstor.h') 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(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(in, i); -- cgit v1.2.3