diff options
author | Nils Schneider <nils.schneider@gmail.com> | 2011-09-30 16:23:26 +0200 |
---|---|---|
committer | Nils Schneider <nils.schneider@gmail.com> | 2011-09-30 20:00:30 +0200 |
commit | 452506fc4153be072fe443fe3e3cbf76d9563a42 (patch) | |
tree | fa05694eb45068da2d54f8c33c0131cb68e617d2 /src | |
parent | 6ccff2cbdebca38e4913b679784a4865edfbb12a (diff) |
simpler ByteReverse
Diffstat (limited to 'src')
-rw-r--r-- | src/util.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/util.h b/src/util.h index 14853a0a2e..c05143bece 100644 --- a/src/util.h +++ b/src/util.h @@ -726,29 +726,10 @@ inline bool AffinityBugWorkaround(void(*pfn)(void*)) return false; } -template <class T> inline T rotlFixed(T x, unsigned int y) -{ - assert(y < sizeof(T)*8); - return T((x<<y) | (x>>(sizeof(T)*8-y))); -} - -template <class T> inline T rotrFixed(T x, unsigned int y) -{ - assert(y < sizeof(T)*8); - return T((x>>y) | (x<<(sizeof(T)*8-y))); -} - inline uint32_t ByteReverse(uint32_t value) { -#if defined(__MWERKS__) && TARGET_CPU_PPC - return (uint32_t)__lwbrx(&value,0); -#elif _MSC_VER >= 1400 || (_MSC_VER >= 1300 && !defined(_DLL)) - return _byteswap_ulong(value); -#else - // 6 instructions with rotate instruction, 8 without value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); - return rotlFixed(value, 16U); -#endif + return (value<<16) | (value>>16); } #endif |