Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / client_osi / largeint.h
blob8c4eb8dcd9c59966324d33f9dbae877d977549f3
1 /*--
3 Module Name:
5 largeint.h
7 Abstract:
9 Include file for sample Large Integer Arithmetic routines.
10 This file includes all of the prototypes for the routines found in
11 largeint.lib. For complete descriptions of these functions, see the
12 largeint.s source file for MIPS, or the divlarge.c and largeint.asm
13 source files for x86.
15 Revision History:
17 --*/
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 //Large integer arithmetic routines.
28 // Large integer add - 64-bits + 64-bits -> 64-bits
31 LARGE_INTEGER
32 LargeIntegerAdd (
33 LARGE_INTEGER Addend1,
34 LARGE_INTEGER Addend2
38 // Enlarged integer multiply - 32-bits * 32-bits -> 64-bits
41 LARGE_INTEGER
42 EnlargedIntegerMultiply (
43 LONG Multiplicand,
44 LONG Multiplier
48 // Unsigned enlarged integer multiply - 32-bits * 32-bits -> 64-bits
51 LARGE_INTEGER
52 EnlargedUnsignedMultiply (
53 ULONG Multiplicand,
54 ULONG Multiplier
58 // Enlarged integer divide - 64-bits / 32-bits > 32-bits
61 ULONG
62 EnlargedUnsignedDivide (
63 IN ULARGE_INTEGER Dividend,
64 IN ULONG Divisor,
65 IN PULONG Remainder
69 // Extended large integer magic divide - 64-bits / 32-bits -> 64-bits
72 LARGE_INTEGER
73 ExtendedMagicDivide (
74 LARGE_INTEGER Dividend,
75 LARGE_INTEGER MagicDivisor,
76 CCHAR ShiftCount
80 // Large Integer divide - 64-bits / 32-bits -> 64-bits
83 LARGE_INTEGER
84 ExtendedLargeIntegerDivide (
85 LARGE_INTEGER Dividend,
86 ULONG Divisor,
87 PULONG Remainder
91 // Large Integer divide - 64-bits / 32-bits -> 64-bits
94 LARGE_INTEGER
95 LargeIntegerDivide (
96 LARGE_INTEGER Dividend,
97 LARGE_INTEGER Divisor,
98 PLARGE_INTEGER Remainder
102 // Extended integer multiply - 32-bits * 64-bits -> 64-bits
105 LARGE_INTEGER
106 ExtendedIntegerMultiply (
107 LARGE_INTEGER Multiplicand,
108 LONG Multiplier
112 // Large integer negation - -(64-bits)
115 LARGE_INTEGER
116 LargeIntegerNegate (
117 LARGE_INTEGER Subtrahend
121 // Large integer subtract - 64-bits - 64-bits -> 64-bits.
124 LARGE_INTEGER
125 LargeIntegerSubtract (
126 LARGE_INTEGER Minuend,
127 LARGE_INTEGER Subtrahend
131 // Large integer and - 64-bite & 64-bits -> 64-bits.
134 #define LargeIntegerAnd(Result, Source, Mask) \
136 Result.HighPart = Source.HighPart & Mask.HighPart; \
137 Result.LowPart = Source.LowPart & Mask.LowPart; \
142 // Large integer conversion routines.
146 // Convert signed integer to large integer.
149 LARGE_INTEGER
150 ConvertLongToLargeInteger (
151 LONG SignedInteger
155 // Convert unsigned integer to large integer.
158 LARGE_INTEGER
159 ConvertUlongToLargeInteger (
160 ULONG UnsignedInteger
165 // Large integer shift routines.
168 LARGE_INTEGER
169 LargeIntegerShiftLeft (
170 LARGE_INTEGER LargeInteger,
171 CCHAR ShiftCount
174 LARGE_INTEGER
175 LargeIntegerShiftRight (
176 LARGE_INTEGER LargeInteger,
177 CCHAR ShiftCount
180 LARGE_INTEGER
181 LargeIntegerArithmeticShift (
182 LARGE_INTEGER LargeInteger,
183 CCHAR ShiftCount
186 #define LargeIntegerGreaterThan(X,Y) ( \
187 (((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \
188 ((X).HighPart > (Y).HighPart) \
191 #define LargeIntegerGreaterThanOrEqualTo(X,Y) ( \
192 (((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \
193 ((X).HighPart > (Y).HighPart) \
196 #define LargeIntegerEqualTo(X,Y) ( \
197 !(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \
200 #define LargeIntegerNotEqualTo(X,Y) ( \
201 (((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \
204 #define LargeIntegerLessThan(X,Y) ( \
205 (((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \
206 ((X).HighPart < (Y).HighPart) \
209 #define LargeIntegerLessThanOrEqualTo(X,Y) ( \
210 (((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \
211 ((X).HighPart < (Y).HighPart) \
214 #define LargeIntegerGreaterThanZero(X) ( \
215 (((X).HighPart == 0) && ((X).LowPart > 0)) || \
216 ((X).HighPart > 0 ) \
219 #define LargeIntegerGreaterOrEqualToZero(X) ( \
220 (X).HighPart >= 0 \
223 #define LargeIntegerEqualToZero(X) ( \
224 !((X).LowPart | (X).HighPart) \
227 #define LargeIntegerNotEqualToZero(X) ( \
228 ((X).LowPart | (X).HighPart) \
231 #define LargeIntegerLessThanZero(X) ( \
232 ((X).HighPart < 0) \
235 #define LargeIntegerLessOrEqualToZero(X) ( \
236 ((X).HighPart < 0) || !((X).LowPart | (X).HighPart) \
239 #ifdef __cplusplus
241 #endif