ntdll: Implement 64-bit shifts

André Hentschel nerv at dawncrow.de
Fri Jul 22 14:57:51 CDT 2011


For TrueCrypt 7
---
 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 54ce6b0..2822cbf 100644
--- a/dlls/ntdll/large_int.c
+++ b/dlls/ntdll/large_int.c
@@ -577,6 +577,39 @@ LONGLONG WINAPI _allrem( LONGLONG a, LONGLONG 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;
+}
 
 /******************************************************************************
  *        _aulldiv   (NTDLL.@)
@@ -613,4 +646,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 0976bc5..87a4991 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1253,13 +1253,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 3ecb7ec..d737311 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1400,12 +1400,12 @@
 @ stdcall -private -ret64 _allmul(int64 int64) ntdll._allmul
 @ stdcall -private -i386 -norelay _alloca_probe() ntdll._alloca_probe
 @ stdcall -private -ret64 _allrem(int64 int64) ntdll._allrem
-@ stub _allshl
-@ stub _allshr
+@ stdcall -private -ret64 _allshl(int64 long) ntdll._allshl
+@ stdcall -private -ret64 _allshr(int64 long) ntdll._allshr
 @ stdcall -private -ret64 _aulldiv(int64 int64) ntdll._aulldiv
 @ stub _aulldvrm
 @ stdcall -private -ret64 _aullrem(int64 int64) ntdll._aullrem
-@ stub _aullshr
+@ stdcall -private -ret64 _aullshr(int64 long) ntdll._aullshr
 @ cdecl -private -i386 _except_handler2(ptr ptr ptr ptr) msvcrt._except_handler2
 @ cdecl -private -i386 _except_handler3(ptr ptr ptr ptr) msvcrt._except_handler3
 @ cdecl -private -i386 _global_unwind2(ptr) msvcrt._global_unwind2
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list