aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-11-20 09:37:08 -0500
committerJack Lloyd <[email protected]>2018-11-20 09:37:08 -0500
commitfd2d283eda8f293a4f2bd5f1c33e63a447e24883 (patch)
tree36500d10fd723c42389bf0034b89c5b4269522d2 /src
parenteea263e826d1d50dc11004eab2afcc312ed4e7e0 (diff)
Use builtin_bswap16 when available
Diffstat (limited to 'src')
-rw-r--r--src/lib/utils/bswap.h4
1 files changed, 4 insertions, 0 deletions
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
}
/**