aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/endian.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/zencore/include/zencore/endian.h b/zencore/include/zencore/endian.h
index 1f79a59e8..d44a27b01 100644
--- a/zencore/include/zencore/endian.h
+++ b/zencore/include/zencore/endian.h
@@ -7,19 +7,31 @@ namespace zen {
inline uint16_t
ByteSwap(uint16_t x)
{
+#if ZEN_COMPILER_MSC
return _byteswap_ushort(x);
+#else
+ return __builtin_bswap16(x);
+#endif
}
inline uint32_t
ByteSwap(uint32_t x)
{
+#if ZEN_COMPILER_MSC
return _byteswap_ulong(x);
+#else
+ return __builtin_bswap32(x);
+#endif
}
inline uint64_t
ByteSwap(uint64_t x)
{
+#if ZEN_COMPILER_MSC
return _byteswap_uint64(x);
+#else
+ return __builtin_bswap64(x);
+#endif
}
inline uint16_t