ntdll: Implement 64-bit shifts
André Hentschel
nerv at dawncrow.de
Wed Aug 3 05:59:59 CDT 2016
Signed-off-by: André Hentschel <nerv at dawncrow.de>
---
This is a rebase of my patch from 2011 as I just had an app that needed it.
It's for Truecrypt 7 and Twincat
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 fc01f83..a0d465c 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 e0c0746..717067f 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 778c3ae..40fff1b 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
--
2.7.4
More information about the wine-patches
mailing list