From 3be063d28ac72676b68bfcb3e47ae9ad6aff3709 Mon Sep 17 00:00:00 2001 From: Ced2911 Date: Thu, 7 Nov 2013 11:39:52 +0100 Subject: [PATCH] [Xbox] Use intrinsics swap --- Common/Common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Common/Common.h b/Common/Common.h index 28f7d51773..c0ee1ca424 100644 --- a/Common/Common.h +++ b/Common/Common.h @@ -153,9 +153,15 @@ private: #ifdef _MSC_VER +#ifndef _XBOX inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); } inline unsigned int bswap32(unsigned int x) { return _byteswap_ulong(x); } -inline unsigned int bswap16(unsigned int x) { return _byteswap_ushort(x); } +inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(x); } +#else +inline unsigned long long bswap64(unsigned long long x) { return __loaddoublewordbytereverse(0, &x); } +inline unsigned int bswap32(unsigned int x) { return __loadwordbytereverse(0, &x); } +inline unsigned short bswap16(unsigned short x) { return __loadshortbytereverse(0, &x); } +#endif #else // TODO: speedup inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); }