summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authormagumagu9 <magumagu9@gmail.com>2008-12-31 20:42:23 +0000
committermagumagu9 <magumagu9@gmail.com>2008-12-31 20:42:23 +0000
commit05df5c8f3f3d5e6a2812fdbad2f64ceb14130409 (patch)
treef65d5d25f49b905a67031c7f135acaf18ce9b62e /Source/Core/Common
parent68c451f008be9341894c3c534dceb4a8a7b93b62 (diff)
Minor fix to rotation helpers so they don't do undefined shifts.
Probably not a big deal realistically, but better to be safe than sorry. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1725 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/Common.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h
index 0c323f51d4..3c9ed887b3 100644
--- a/Source/Core/Common/Src/Common.h
+++ b/Source/Core/Common/Src/Common.h
@@ -131,10 +131,14 @@ extern "C" {
#if !defined(_WIN32)
inline u32 _rotl(u32 x, int shift) {
+ shift &= 31;
+ if (!shift) return x;
return (x << shift) | (x >> (32 - shift));
}
inline u32 _rotr(u32 x, int shift) {
+ shift &= 31;
+ if (!shift) return x;
return (x >> shift) | (x << (32 - shift));
}