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
This commit is contained in:
parent
68c451f008
commit
05df5c8f3f
|
@ -131,10 +131,14 @@ extern "C" {
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
inline u32 _rotl(u32 x, int shift) {
|
inline u32 _rotl(u32 x, int shift) {
|
||||||
|
shift &= 31;
|
||||||
|
if (!shift) return x;
|
||||||
return (x << shift) | (x >> (32 - shift));
|
return (x << shift) | (x >> (32 - shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 _rotr(u32 x, int shift) {
|
inline u32 _rotr(u32 x, int shift) {
|
||||||
|
shift &= 31;
|
||||||
|
if (!shift) return x;
|
||||||
return (x >> shift) | (x << (32 - shift));
|
return (x >> shift) | (x << (32 - shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue