Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

largeic.c

Go to the documentation of this file.
00001 00010 /*++ 00011 00012 Copyright (c) 1996 Intel Corporation 00013 Copyright (c) 1990 Microsoft Corporation 00014 00015 Module Name: 00016 00017 largeic.c 00018 00019 Abstract: 00020 00021 This module implements routines for performing extended integer 00022 division. 00023 00024 Author: 00025 00026 William K. Cheung (wcheung) 12-Apr-1996 00027 00028 Environment: 00029 00030 Any mode. 00031 00032 Revision History: 00033 00034 --*/ 00035 00036 #include "ntrtlp.h" 00037 00038 00039 LARGE_INTEGER 00040 RtlExtendedLargeIntegerDivide ( 00041 IN LARGE_INTEGER Dividend, 00042 IN ULONG Divisor, 00043 IN OUT PULONG Remainder OPTIONAL 00044 ) 00045 00046 /*++ 00047 00048 Routine Description: 00049 00050 This function divides an unsigned large integer by an unsigned long 00051 and returns the resultant quotient and optionally the remainder. 00052 00053 Arguments: 00054 00055 Dividend - Supplies the dividend value. 00056 00057 Divisor - Supplies the divisor value. 00058 00059 Remainder - Supplies an optional pointer to a variable 00060 that receives the remainder. 00061 00062 Return Value: 00063 00064 The large integer result is stored at the address supplied by a0. 00065 00066 --*/ 00067 00068 { 00069 LARGE_INTEGER Quotient; 00070 00071 Quotient.QuadPart = Dividend.QuadPart / Divisor; 00072 if (Remainder) { 00073 *Remainder = (ULONG)(Dividend.QuadPart % Divisor); 00074 } 00075 return Quotient; 00076 } 00077 00078 LARGE_INTEGER 00079 RtlLargeIntegerDivide ( 00080 IN LARGE_INTEGER Dividend, 00081 IN LARGE_INTEGER Divisor, 00082 IN PLARGE_INTEGER Remainder OPTIONAL 00083 ) 00084 00085 /*++ 00086 00087 Routine Description: 00088 00089 This function divides an unsigned large integer by an unsigned 00090 large and returns the resultant quotient and optionally the remainder. 00091 00092 Arguments: 00093 00094 Dividend - Supplies the dividend value. 00095 00096 Divisor - Supplies the divisor value. 00097 00098 Remainder - Supplies an optional pointer to a variable 00099 that receives the remainder. 00100 00101 Return Value: 00102 00103 The large integer result is stored at the address supplied by a0. 00104 00105 --*/ 00106 { 00107 LARGE_INTEGER Quotient; 00108 00109 Quotient.QuadPart = (ULONGLONG)Dividend.QuadPart / (ULONGLONG)Divisor.QuadPart; 00110 if (Remainder) { 00111 Remainder->QuadPart = ((ULONGLONG)Dividend.QuadPart % (ULONGLONG)Divisor.QuadPart); 00112 } 00113 return Quotient; 00114 } 00115 00116 LARGE_INTEGER 00117 RtlExtendedIntegerMultiply ( 00118 IN LARGE_INTEGER Multiplicand, 00119 IN LONG Multiplier 00120 ) 00121 /*++ 00122 00123 00124 Routine Description: 00125 00126 This function multiplies a signed large integer by a signed integer and 00127 returns the signed large integer result. 00128 00129 N.B. An overflow is possible, but no exception is generated. 00130 00131 Arguments: 00132 00133 Multiplicand - Supplies the multiplicand value. 00134 00135 Multiplier - Supplies the multiplier value. 00136 00137 Return Value: 00138 00139 The large integer result is returned 00140 00141 --*/ 00142 { 00143 LARGE_INTEGER Result; 00144 00145 Result.QuadPart = Multiplicand.QuadPart * (LONGLONG)Multiplier; 00146 return (Result); 00147 }

Generated on Sat May 15 19:40:35 2004 for test by doxygen 1.3.7