Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: sky/engine/wtf/ByteSwap.h

Issue 719063002: Revert "Remove support for MSVC" (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/wtf/ByteSwap.h
diff --git a/sky/engine/wtf/ByteSwap.h b/sky/engine/wtf/ByteSwap.h
index 51012b93da5c900b93221529d70b2a4ffd63bc79..ddc0e8fe43285b31003247a8f01dd731c13d0c9d 100644
--- a/sky/engine/wtf/ByteSwap.h
+++ b/sky/engine/wtf/ByteSwap.h
@@ -36,10 +36,22 @@
#include <stdint.h>
+#if COMPILER(MSVC)
+#include <stdlib.h>
+#endif
+
namespace WTF {
inline uint32_t wswap32(uint32_t x) { return ((x & 0xffff0000) >> 16) | ((x & 0x0000ffff) << 16); }
+#if COMPILER(MSVC)
+
+ALWAYS_INLINE uint64_t bswap64(uint64_t x) { return _byteswap_uint64(x); }
+ALWAYS_INLINE uint32_t bswap32(uint32_t x) { return _byteswap_ulong(x); }
+ALWAYS_INLINE uint16_t bswap16(uint16_t x) { return _byteswap_ushort(x); }
+
+#else
+
ALWAYS_INLINE uint64_t bswap64(uint64_t x) { return __builtin_bswap64(x); }
ALWAYS_INLINE uint32_t bswap32(uint32_t x) { return __builtin_bswap32(x); }
// GCC 4.6 lacks __builtin_bswap16. Newer versions have it but we support 4.6.
@@ -49,6 +61,8 @@ ALWAYS_INLINE uint16_t bswap16(uint16_t x) { return __builtin_bswap16(x); }
inline uint16_t bswap16(uint16_t x) { return ((x & 0xff00) >> 8) | ((x & 0x00ff) << 8); }
#endif
+#endif
+
#if CPU(64BIT)
ALWAYS_INLINE size_t bswapuintptrt(size_t x) { return bswap64(x); }

Powered by Google App Engine
This is Rietveld 408576698