From fd2d283eda8f293a4f2bd5f1c33e63a447e24883 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Tue, 20 Nov 2018 09:37:08 -0500 Subject: Use builtin_bswap16 when available --- src/lib/utils/bswap.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/lib/utils/bswap.h b/src/lib/utils/bswap.h index 8d5731f1b..509e911e0 100644 --- a/src/lib/utils/bswap.h +++ b/src/lib/utils/bswap.h @@ -23,7 +23,11 @@ namespace Botan { */ inline uint16_t reverse_bytes(uint16_t val) { +#if defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG) + return __builtin_bswap16(val); +#else return rotl<8>(val); +#endif } /** -- cgit v1.2.3