aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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
}
/**