From 05df5c8f3f3d5e6a2812fdbad2f64ceb14130409 Mon Sep 17 00:00:00 2001 From: magumagu9 Date: Wed, 31 Dec 2008 20:42:23 +0000 Subject: [PATCH] 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 --- Source/Core/Common/Src/Common.h | 4 ++++ 1 file changed, 4 insertions(+) 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)); }