From: Julian Seward Date: Sun, 21 Nov 2004 19:22:35 +0000 (+0000) Subject: Fix behaviour so that out-of-range shifts behave the same as on a X-Git-Tag: svn/VALGRIND_3_0_1^2~759 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9edc865c3e364196202a5dd96a29a368df94bb34;p=thirdparty%2Fvalgrind.git Fix behaviour so that out-of-range shifts behave the same as on a PIII. git-svn-id: svn://svn.valgrind.org/vex/trunk@575 --- diff --git a/VEX/priv/guest-x86/ghelpers.c b/VEX/priv/guest-x86/ghelpers.c index 51c41ceef0..2253bfd4be 100644 --- a/VEX/priv/guest-x86/ghelpers.c +++ b/VEX/priv/guest-x86/ghelpers.c @@ -1839,34 +1839,34 @@ static inline UChar qnarrow16Uto8 ( UShort xx0 ) return (UChar)xx; } -static inline UShort shl16 ( UShort v, UShort n ) +static inline UShort shl16 ( UShort v, ULong n ) { return n > 15 ? 0 : v << n; } -static inline UShort shr16U ( UShort v, UShort n ) +static inline UShort shr16U ( UShort v, ULong n ) { return n > 15 ? 0 : (((UShort)v) >> n); } -static inline UShort shr16S ( UShort v, UShort n ) +static inline UShort shr16S ( UShort v, ULong n ) { if (n <= 15) return ((Short)v) >> n; return (v & 0x8000) ? 0xFFFF : 0; } -static inline UInt shl32 ( UInt v, UInt n ) +static inline UInt shl32 ( UInt v, ULong n ) { return n > 31 ? 0 : v << n; } -static inline UInt shr32U ( UInt v, UInt n ) +static inline UInt shr32U ( UInt v, ULong n ) { return n > 31 ? 0 : (((UInt)v) >> n); } -static inline UInt shr32S ( UInt v, UInt n ) +static inline UInt shr32S ( UInt v, ULong n ) { if (n <= 31) return ((Int)v) >> n;