From d22964d95251f6870090fcfdfc72321bf2141146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Thu, 4 Aug 2016 22:04:29 +0200 Subject: [PATCH] ntdll: Implement 64-bit shifts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Hentschel Signed-off-by: Alexandre Julliard --- dlls/ntdll/large_int.c | 50 +++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 6 ++-- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 6 ++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c index fc01f8356dd..a0d465c494a 100644 --- a/dlls/ntdll/large_int.c +++ b/dlls/ntdll/large_int.c @@ -592,6 +592,39 @@ ULONGLONG WINAPI _aulldiv( ULONGLONG a, ULONGLONG b ) return a / b; } +/****************************************************************************** + * _allshl (NTDLL.@) + * + * Shift a 64 bit integer to the left. + * + * PARAMS + * a [I] Initial number. + * b [I] Number to shift a by to the left. + * + * RETURNS + * The left-shifted value. + */ +LONGLONG WINAPI _allshl( LONGLONG a, LONG b ) +{ + return a << b; +} + +/****************************************************************************** + * _allshr (NTDLL.@) + * + * Shift a 64 bit integer to the right. + * + * PARAMS + * a [I] Initial number. + * b [I] Number to shift a by to the right. + * + * RETURNS + * The right-shifted value. + */ +LONGLONG WINAPI _allshr( LONGLONG a, LONG b ) +{ + return a >> b; +} /****************************************************************************** * _aullrem (NTDLL.@) @@ -610,4 +643,21 @@ ULONGLONG WINAPI _aullrem( ULONGLONG a, ULONGLONG b ) return a % b; } +/****************************************************************************** + * _aullshr (NTDLL.@) + * + * Shift a 64 bit unsigned integer to the right. + * + * PARAMS + * a [I] Initial number. + * b [I] Number to shift a by to the right. + * + * RETURNS + * The right-shifted value. + */ +ULONGLONG WINAPI _aullshr( ULONGLONG a, LONG b ) +{ + return a >> b; +} + #endif /* __i386__ */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index e0c0746779f..717067f4527 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1331,13 +1331,13 @@ @ stdcall -private -arch=i386 -ret64 _allmul(int64 int64) @ stdcall -private -arch=i386 -norelay _alloca_probe() @ stdcall -private -arch=i386 -ret64 _allrem(int64 int64) -# @ stub _allshl -# @ stub _allshr +@ stdcall -private -arch=i386 -ret64 _allshl(int64 long) +@ stdcall -private -arch=i386 -ret64 _allshr(int64 long) @ cdecl -private -ret64 _atoi64(str) @ stdcall -private -arch=i386 -ret64 _aulldiv(int64 int64) # @ stub _aulldvrm @ stdcall -private -arch=i386 -ret64 _aullrem(int64 int64) -# @ stub _aullshr +@ stdcall -private -arch=i386 -ret64 _aullshr(int64 long) @ stdcall -private -arch=i386 -norelay _chkstk() @ stub _fltused @ cdecl -private -arch=i386 -ret64 _ftol() NTDLL__ftol diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 778c3ae584c..40fff1bb603 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1400,12 +1400,12 @@ @ stdcall -private -arch=i386 -ret64 _allmul(int64 int64) ntdll._allmul @ stdcall -private -arch=i386 -norelay _alloca_probe() ntdll._alloca_probe @ stdcall -private -arch=i386 -ret64 _allrem(int64 int64) ntdll._allrem -@ stub _allshl -@ stub _allshr +@ stdcall -private -arch=i386 -ret64 _allshl(int64 long) ntdll._allshl +@ stdcall -private -arch=i386 -ret64 _allshr(int64 long) ntdll._allshr @ stdcall -private -arch=i386 -ret64 _aulldiv(int64 int64) ntdll._aulldiv @ stub _aulldvrm @ stdcall -private -arch=i386 -ret64 _aullrem(int64 int64) ntdll._aullrem -@ stub _aullshr +@ stdcall -private -arch=i386 -ret64 _aullshr(int64 long) ntdll._aullshr @ cdecl -private -arch=i386 _except_handler2(ptr ptr ptr ptr) msvcrt._except_handler2 @ cdecl -private -arch=i386 _except_handler3(ptr ptr ptr ptr) msvcrt._except_handler3 @ cdecl -private -arch=i386 _global_unwind2(ptr) msvcrt._global_unwind2