4 Large (64 bits) integer arithmetics library
6 Written by Anders Norlander <anorland@hem2.passagen.se>
8 This file is part of a free library for the Win32 API.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 #define __COMPILING_LARGEINT
21 LargeIntegerAdd (__int64 i1, __int64 i2)
27 LargeIntegerSubtract (__int64 i1, __int64 i2)
33 LargeIntegerArithmeticShift (__int64 i, int n)
39 LargeIntegerShiftLeft (__int64 i, int n)
45 LargeIntegerShiftRight (__int64 i, int n)
51 LargeIntegerNegate (__int64 i)
57 ConvertLongToLargeInteger (LONG l)
63 ConvertUlongToLargeInteger (ULONG ul)
65 return _toi(_toui(ul));
69 EnlargedIntegerMultiply (LONG l1, LONG l2)
71 return _toi(l1) * _toi(l2);
75 EnlargedUnsignedMultiply (ULONG ul1, ULONG ul2)
77 return _toi(_toui(ul1) * _toui(ul2));
81 ExtendedIntegerMultiply (__int64 i, LONG l)
87 LargeIntegerMultiply (__int64 i1, __int64 i2)
92 __int64 WINAPI LargeIntegerDivide (__int64 i1, __int64 i2, __int64 *remainder)
100 EnlargedUnsignedDivide (unsigned __int64 i1, ULONG i2, PULONG remainder)
103 *remainder = i1 % _toi(i2);
104 return i1 / _toi(i2);
107 ExtendedLargeIntegerDivide (__int64 i1, ULONG i2, PULONG remainder)
110 *remainder = i1 % _toi(i2);
111 return i1 / _toi(i2);
114 /* FIXME: what is this function supposed to do? */
115 __int64 WINAPI ExtendedMagicDivide (__int64 i1, __int64 i2, int n)