Added some RtlLargeInteger functions.

svn path=/trunk/; revision=762
This commit is contained in:
Eric Kohl 1999-11-09 18:09:57 +00:00
parent 761e03c5a1
commit 58b907b668
7 changed files with 142 additions and 133 deletions

View file

@ -1212,7 +1212,7 @@ DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n",
PartitionExtent.QuadPart = DeviceExtension->Offset + DeviceExtension->Size;
PartitionExtent = RtlExtendedIntegerMultiply(PartitionExtent,
DeviceExtension->BytesPerSector);
if (RtlLargeIntegerGreaterThan(AdjustedExtent, PartitionExtent) ||
if ((AdjustedExtent.QuadPart > PartitionExtent.QuadPart) ||
(IrpStack->Parameters.Read.Length & (DeviceExtension->BytesPerSector - 1)))
{
DPRINT("Request failed on bad parameters\n",0);

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.18 1999/10/21 16:13:39 ekohl Exp $
; $Id: ntdll.def,v 1.19 1999/11/09 18:09:57 ekohl Exp $
;
; ReactOS Operating System
;
@ -439,6 +439,8 @@ RtlCreateUserThread@40
RtlCompactHeap@8
RtlCompareString
RtlCompareUnicodeString
RtlConvertLongToLargeInteger
RtlConvertUlongToLargeInteger
RtlCopyString
RtlCopyUnicodeString
RtlDestroyHeap@4
@ -459,6 +461,10 @@ RtlInitUnicodeString
RtlIntegerToUnicodeString
RtlLargeIntegerAdd
RtlLargeIntegerDivide
RtlLargeIntegerNegate
RtlLargeIntegerShiftLeft
RtlLargeIntegerShiftRight
RtlLargeIntegerSubtract
RtlLengthSecurityDescriptor
RtlLockHeap@4
RtlMoveMemory@12

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.8 1999/10/21 16:13:39 ekohl Exp $
; $Id: ntdll.edf,v 1.9 1999/11/09 18:09:57 ekohl Exp $
;
; ReactOS Operating System
;
@ -439,6 +439,8 @@ RtlCreateUserThread=RtlCreateUserThread@40
RtlCompactHeap=RtlCompactHeap@8
RtlCompareString
RtlCompareUnicodeString
RtlConvertLongToLargeInteger
RtlConvertUlongToLargeInteger
RtlCopyString
RtlCopyUnicodeString
RtlDestroyHeap=RtlDestroyHeap@4
@ -459,6 +461,10 @@ RtlInitUnicodeString
RtlIntegerToUnicodeString
RtlLargeIntegerAdd
RtlLargeIntegerDivide
RtlLargeIntegerNegate
RtlLargeIntegerShiftLeft
RtlLargeIntegerShiftRight
RtlLargeIntegerSubtract
RtlLengthSecurityDescriptor
RtlLockHeap=RtlLockHeap@4
RtlMoveMemory=RtlMoveMemory@12

View file

@ -1,4 +1,4 @@
/* $Id: largeint.c,v 1.4 1999/09/29 23:09:44 ekohl Exp $
/* $Id: largeint.c,v 1.5 1999/11/09 18:09:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -12,28 +12,13 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/linkage.h>
#define NDEBUG
#include <internal/debug.h>
typedef long long int LLI, *PLLI;
typedef unsigned long long int ULLI, *PULLI;
#define LIFromLLI(X) (*(PLARGE_INTEGER)&(X))
#define LLIFromLI(X) (*(PLLI)&(X))
#define ULIFromULLI(X) (*(PULARGE_INTEGER)&(X))
/* FUNCTIONS *****************************************************************/
LARGE_INTEGER
RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER Divisor,
PLARGE_INTEGER Remainder)
{
}
LARGE_INTEGER
RtlConvertLongToLargeInteger(LONG SignedInteger)
{
@ -65,8 +50,9 @@ RtlEnlargedIntegerMultiply(LONG Multiplicand,
return RC;
}
LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
ULONG Multiplier)
LARGE_INTEGER
RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
ULONG Multiplier)
{
LARGE_INTEGER RC;
@ -97,13 +83,30 @@ RtlLargeIntegerAdd(LARGE_INTEGER Addend1,
return RC;
}
VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask)
VOID
RtlLargeIntegerAnd(PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask)
{
Result->QuadPart = Source.QuadPart & Mask.QuadPart;
}
LARGE_INTEGER
RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER Divisor,
PLARGE_INTEGER Remainder)
{
LARGE_INTEGER RC;
if (Remainder)
Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart;
RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart;
return RC;
}
BOOLEAN
RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.23 1999/11/04 06:41:47 ea Exp $
; $Id: ntoskrnl.def,v 1.24 1999/11/09 18:04:26 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -173,19 +173,28 @@ NtUnlockFile@20
NtWaitForSingleObject@12
NtWriteFile@36
RtlAnsiStringToUnicodeString
RtlCompareMemory
RtlCompareMemory@12
RtlConvertLongToLargeInteger
RtlConvertUlongToLargeInteger
RtlCopyMemory
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
RtlExtendedIntegerMultiply
RtlExtendedLargeIntegerDivide
RtlExtendedMagicDivide
RtlFillMemory@12
RtlFillMemoryUlong@12
RtlFreeUnicodeString
RtlInitAnsiString
RtlInitUnicodeString
RtlLargeIntegerAdd
RtlLargeIntegerGreaterThan
RtlLargeIntegerArithmeticShift
RtlLargeIntegerDivide
RtlLargeIntegerNegate
RtlLargeIntegerShiftLeft
RtlLargeIntegerShiftRight
RtlLargeIntegerSubtract
RtlMoveMemory@12
RtlSecondsSince1970ToTime
RtlSecondsSince1980ToTime

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.10 1999/10/31 22:41:49 ea Exp $
; $Id: ntoskrnl.edf,v 1.11 1999/11/09 18:04:26 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -173,19 +173,28 @@ NtUnlockFile=NtUnlockFile@20
NtWaitForSingleObject=NtWaitForSingleObject@12
NtWriteFile=NtWriteFile@36
RtlAnsiStringToUnicodeString
RtlCompareMemory
RtlCompareMemory=RtlCompareMemory@12
RtlConvertLongToLargeInteger
RtlConvertUlongToLargeInteger
RtlCopyMemory
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
RtlExtendedIntegerMultiply
RtlExtendedLargeIntegerDivide
RtlExtendedMagicDivide
RtlFillMemory=RtlFillMemory@12
RtlFillMemoryUlong=RtlFillMemoryUlong@12
RtlFreeUnicodeString
RtlInitAnsiString
RtlInitUnicodeString
RtlLargeIntegerAdd
RtlLargeIntegerGreaterThan
RtlLargeIntegerArithmeticShift
RtlLargeIntegerDivide
RtlLargeIntegerNegate
RtlLargeIntegerShiftLeft
RtlLargeIntegerShiftRight
RtlLargeIntegerSubtract
RtlMoveMemory=RtlMoveMemory@12
RtlSecondsSince1970ToTime
RtlSecondsSince1980ToTime

View file

@ -1,4 +1,5 @@
/*
/* $Id: largeint.c,v 1.8 1999/11/09 18:01:43 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: kernel/rtl/largeint.c
@ -11,18 +12,10 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/linkage.h>
#define NDEBUG
#include <internal/debug.h>
typedef long long int LLI, *PLLI;
typedef unsigned long long int ULLI, *PULLI;
#define LIFromLLI(X) (*(PLARGE_INTEGER)&(X))
#define LLIFromLI(X) (*(PLLI)&(X))
#define ULIFromULLI(X) (*(PULARGE_INTEGER)&(X))
/* FUNCTIONS *****************************************************************/
@ -57,15 +50,20 @@ RtlEnlargedIntegerMultiply(LONG Multiplicand,
return RC;
}
ULONG RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder)
ULONG
RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder)
{
UNIMPLEMENTED;
if (Remainder)
*Remainder = Dividend.QuadPart % Divisor;
return (ULONG)(Dividend.QuadPart / Divisor);
}
LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
ULONG Multiplier)
LARGE_INTEGER
RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
ULONG Multiplier)
{
LARGE_INTEGER RC;
@ -85,23 +83,25 @@ RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand,
return RC;
}
LARGE_INTEGER RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder)
LARGE_INTEGER
RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder)
{
UNIMPLEMENTED;
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 ExInterlockedAddLargeInteger(PLARGE_INTEGER Addend,
LARGE_INTEGER Increment,
PKSPIN_LOCK Lock)
LARGE_INTEGER
RtlExtendedMagicDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER MagicDivisor,
CCHAR ShiftCount)
{
UNIMPLEMENTED;
}
@ -117,47 +117,50 @@ RtlLargeIntegerAdd(LARGE_INTEGER Addend1,
return RC;
}
VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask)
VOID
RtlLargeIntegerAnd(PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask)
{
Result->QuadPart = Source.QuadPart & Mask.QuadPart;
}
LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
LARGE_INTEGER
RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
UNIMPLEMENTED;
#if 0
LARGE_INTEGER RC;
CHAR Shift;
Shift = ShiftCount % 64;
RC.QuadPart = LargeInteger.QuadPart >> ShiftCount;
asm ("movb %2, %%cl\n\t"
"andb $0x3f, %%cl\n\t"
"movl %3, %%eax\n\t"
"movl %4, %%edx\n\t"
"shrdl %%cl, %%edx, %%eax\n\t"
"sarl %%cl, %%edx\n\t"
"movl %%eax, %0\n\t"
"movl %%edx, %1\n\t"
: "=m" (LargeInteger.LowPart),
"=m" (LargeInteger.HighPart)
: "m" (ShiftCount),
"0" (LargeInteger.LowPart),
"1" (LargeInteger.HighPart)
: "eax", "ecx", "edx"
);
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;
#endif
}
LARGE_INTEGER RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER Divisor,
PLARGE_INTEGER Remainder)
LARGE_INTEGER
RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER Divisor,
PLARGE_INTEGER Remainder)
{
UNIMPLEMENTED;
LARGE_INTEGER RC;
if (Remainder)
Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart;
RC.QuadPart = Dividend.QuadPart / Divisor.QuadPart;
return RC;
}
BOOLEAN
@ -165,10 +168,6 @@ RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return Operand1.QuadPart == Operand2.QuadPart;
#if 0
return Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart == Operand2.LowPart;
#endif
}
BOOLEAN
@ -182,11 +181,6 @@ RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return Operand1.QuadPart > Operand2.QuadPart;
#if 0
return Operand1.HighPart > Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart > Operand2.LowPart);
#endif
}
BOOLEAN
@ -194,30 +188,18 @@ RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return Operand1.QuadPart >= Operand2.QuadPart;
#if 0
return Operand1.HighPart > Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart >= Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1)
{
return Operand1.QuadPart >= 0;
#if 0
return Operand1.HighPart >= 0;
#endif
}
BOOLEAN
RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1)
{
return Operand1.QuadPart > 0;
#if 0
return Operand1.HighPart > 0 ||
(Operand1.HighPart == 0 && Operand1.LowPart > 0);
#endif
}
BOOLEAN
@ -225,11 +207,6 @@ RtlLargeIntegerLessThan(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return Operand1.QuadPart < Operand2.QuadPart;
#if 0
return Operand1.HighPart < Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart < Operand2.LowPart);
#endif
}
BOOLEAN
@ -237,33 +214,22 @@ RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return Operand1.QuadPart <= Operand2.QuadPart;
#if 0
return Operand1.HighPart < Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart <= Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand)
{
return Operand.QuadPart <= 0;
#if 0
return Operand.HighPart < 0 ||
(Operand.HighPart == 0 && Operand.LowPart == 0);
#endif
}
BOOLEAN
RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand)
{
return Operand.QuadPart < 0;
#if 0
return Operand.HighPart < 0;
#endif
}
LARGE_INTEGER RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend)
LARGE_INTEGER
RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend)
{
LARGE_INTEGER RC;
@ -285,28 +251,37 @@ RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand)
return Operand.QuadPart != 0;
}
LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
LARGE_INTEGER
RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
LARGE_INTEGER RC;
CHAR Shift;
RC.QuadPart = LargeInteger.QuadPart << ShiftCount;
Shift = ShiftCount % 64;
RC.QuadPart = LargeInteger.QuadPart << Shift;
return RC;
}
LARGE_INTEGER RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
LARGE_INTEGER
RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
LARGE_INTEGER RC;
CHAR Shift;
Shift = ShiftCount % 64;
RC.QuadPart = LargeInteger.QuadPart >> ShiftCount;
return RC;
}
LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend,
LARGE_INTEGER Subtrahend)
LARGE_INTEGER
RtlLargeIntegerSubtract(LARGE_INTEGER Minuend,
LARGE_INTEGER Subtrahend)
{
LARGE_INTEGER RC;
@ -315,3 +290,4 @@ LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend,
return RC;
}
/* EOF */