From c114003cb5149beff1eea02cc032d44025289c22 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 15 Nov 1999 16:01:32 +0000 Subject: [PATCH] Added some RtlLargeInteger functions. svn path=/trunk/; revision=770 --- reactos/lib/ntdll/rtl/largeint.c | 71 ++++++++++++++++++++++++++++++-- reactos/lib/ntdll/stubs/stubs.c | 3 -- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/reactos/lib/ntdll/rtl/largeint.c b/reactos/lib/ntdll/rtl/largeint.c index a2374d405a5..2707c304a7b 100644 --- a/reactos/lib/ntdll/rtl/largeint.c +++ b/reactos/lib/ntdll/rtl/largeint.c @@ -1,4 +1,4 @@ -/* $Id: largeint.c,v 1.5 1999/11/09 18:09:00 ekohl Exp $ +/* $Id: largeint.c,v 1.6 1999/11/15 16:00:19 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -14,7 +14,7 @@ #include #define NDEBUG -#include +#include /* FUNCTIONS *****************************************************************/ @@ -50,6 +50,17 @@ RtlEnlargedIntegerMultiply(LONG Multiplicand, return RC; } +ULONG +RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder) +{ + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; + + return (ULONG)(Dividend.QuadPart / Divisor); +} + LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand, ULONG Multiplier) @@ -72,6 +83,29 @@ RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand, return RC; } +LARGE_INTEGER +RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder) +{ + LARGE_INTEGER RC; + + if (Remainder) + *Remainder = Dividend.QuadPart % Divisor; + + RC.QuadPart = Dividend.QuadPart / Divisor; + + return RC; +} + +LARGE_INTEGER +RtlExtendedMagicDivide(LARGE_INTEGER Dividend, + LARGE_INTEGER MagicDivisor, + CCHAR ShiftCount) +{ + UNIMPLEMENTED; +} + LARGE_INTEGER RtlLargeIntegerAdd(LARGE_INTEGER Addend1, LARGE_INTEGER Addend2) @@ -91,6 +125,29 @@ RtlLargeIntegerAnd(PLARGE_INTEGER Result, Result->QuadPart = Source.QuadPart & Mask.QuadPart; } +LARGE_INTEGER +RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, + CCHAR ShiftCount) +{ + LARGE_INTEGER RC; + CHAR Shift; + + Shift = ShiftCount % 64; + + if (Shift < 32) + { + RC.QuadPart = LargeInteger.QuadPart >> Shift; + } + else + { + /* copy the sign bit */ + RC.u.HighPart |= (LargeInteger.u.HighPart & 0x80000000); + RC.u.LowPart = LargeInteger.u.HighPart >> Shift; + } + + return RC; +} + LARGE_INTEGER RtlLargeIntegerDivide(LARGE_INTEGER Dividend, LARGE_INTEGER Divisor, @@ -200,8 +257,11 @@ RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, CCHAR ShiftCount) { LARGE_INTEGER RC; + CCHAR Shift; - RC.QuadPart = LargeInteger.QuadPart << ShiftCount; + Shift = ShiftCount % 64; + + RC.QuadPart = LargeInteger.QuadPart << Shift; return RC; } @@ -211,8 +271,11 @@ RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger, CCHAR ShiftCount) { LARGE_INTEGER RC; + CCHAR Shift; - RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; + Shift = ShiftCount % 64; + + RC.QuadPart = LargeInteger.QuadPart >> Shift; return RC; } diff --git a/reactos/lib/ntdll/stubs/stubs.c b/reactos/lib/ntdll/stubs/stubs.c index 71772772cbf..6f2f2055403 100644 --- a/reactos/lib/ntdll/stubs/stubs.c +++ b/reactos/lib/ntdll/stubs/stubs.c @@ -54,9 +54,6 @@ STUB(LdrShutdownProcess) STUB(LdrShutdownThread) STUB(LdrVerifyImageMatchesChecksum) STUB(NPXEMULATORTABLE) -STUB(NlsAnsiCodePage) -STUB(NlsMbCodePageTag) -STUB(NlsMbOemCodePageTag) STUB(PfxFindPrefix) STUB(PfxInitialize) STUB(PfxInsertPrefix)