From: Zebediah Figura zfigura@codeweavers.com
Based on a patch by Zhao Yi. --- dlls/ntdll/large_int.c | 15 ++++++++++++--- dlls/ntdll/tests/large_int.c | 10 +++++----- 2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c index 038a552545f..0973888d654 100644 --- a/dlls/ntdll/large_int.c +++ b/dlls/ntdll/large_int.c @@ -817,7 +817,10 @@ LONGLONG __stdcall __regs__allshl( LONGLONG a, unsigned char b )
if (b >= 32) { - ret.HighPart = x.LowPart << (b & 31); + if (b >= 64) + ret.HighPart = 0; + else + ret.HighPart = x.LowPart << (b & 31); ret.LowPart = 0; } else @@ -847,7 +850,10 @@ LONGLONG __stdcall __regs__allshr( LONGLONG a, unsigned char b ) if (b >= 32) { ret.HighPart = x.HighPart >> 31; - ret.LowPart = x.HighPart >> (b & 31); + if (b >= 64) + ret.LowPart = x.HighPart >> 31; + else + ret.LowPart = x.HighPart >> (b & 31); } else { @@ -876,7 +882,10 @@ ULONGLONG __stdcall __regs__aullshr( ULONGLONG a, unsigned char b ) if (b >= 32) { ret.HighPart = 0; - ret.LowPart = x.HighPart >> (b & 31); + if (b >= 64) + ret.LowPart = 0; + else + ret.LowPart = x.HighPart >> (b & 31); } else { diff --git a/dlls/ntdll/tests/large_int.c b/dlls/ntdll/tests/large_int.c index 747aa9ea8d2..a31100f6874 100644 --- a/dlls/ntdll/tests/large_int.c +++ b/dlls/ntdll/tests/large_int.c @@ -526,10 +526,10 @@ static void test_builtins(void) ok(l == 0xbcdef00000000000ll, "got %#I64x\n", l);
l = call_shift_func(p_allshl, 0x0123456789abcdefll, 88); - todo_wine ok(!l, "got %#I64x\n", l); + ok(!l, "got %#I64x\n", l);
l = call_shift_func(p_allshl, 0x0123456789abcdefll, 0x88); - todo_wine ok(!l, "got %#I64x\n", l); + ok(!l, "got %#I64x\n", l);
l = call_shift_func(p_allshl, 0x0123456789abcdefll, 0x108); ok(l == 0x23456789abcdef00ll, "got %#I64x\n", l); @@ -541,7 +541,7 @@ static void test_builtins(void) ok(l == 0x01234ll, "got %#I64x\n", l);
l = call_shift_func(p_allshr, 0x0123456789abcdefll, 88); - todo_wine ok(!l, "got %#I64x\n", l); + ok(!l, "got %#I64x\n", l);
l = call_shift_func(p_allshr, 0x8123456789abcdefll, 12); ok(l == 0xfff8123456789abcll, "got %#I64x\n", l); @@ -550,7 +550,7 @@ static void test_builtins(void) ok(l == 0xfffffffffff81234ll, "got %#I64x\n", l);
l = call_shift_func(p_allshr, 0x8123456789abcdefll, 88); - todo_wine ok(l == -1ll, "got %#I64x\n", l); + ok(l == -1ll, "got %#I64x\n", l);
l = call_shift_func(p_allshr, 0x8123456789abcdefll, 0x108); ok(l == 0xff8123456789abcdll, "got %#I64x\n", l); @@ -562,7 +562,7 @@ static void test_builtins(void) ok(l == 0x81234ll, "got %#I64x\n", l);
l = call_shift_func(p_aullshr, 0x8123456789abcdefll, 88); - todo_wine ok(!l, "got %#I64x\n", l); + ok(!l, "got %#I64x\n", l);
l = call_shift_func(p_aullshr, 0x8123456789abcdefll, 0x108); ok(l == 0x8123456789abcdll, "got %#I64x\n", l);