1 #if 0 2 /* 3 largeint.c 4 5 Large (64 bits) integer arithmetics library 6 7 Written by Anders Norlander <anorland@hem2.passagen.se> 8 9 This file is part of a free library for the Win32 API. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15 */ 16 17 #define __COMPILING_LARGEINT 18 19 #include <largeint.h> 20 21 __int64 WINAPI 22 LargeIntegerAdd (__int64 i1, __int64 i2) 23 { 24 return i1 + i2; 25 } 26 27 __int64 WINAPI 28 LargeIntegerSubtract (__int64 i1, __int64 i2) 29 { 30 return i1 - i2; 31 } 32 33 __int64 WINAPI 34 LargeIntegerArithmeticShift (__int64 i, int n) 35 { 36 return i >> n; 37 } 38 39 __int64 WINAPI 40 LargeIntegerShiftLeft (__int64 i, int n) 41 { 42 return i << n; 43 } 44 45 __int64 WINAPI 46 LargeIntegerShiftRight (__int64 i, int n) 47 { 48 return i >> n; 49 } 50 51 __int64 WINAPI 52 LargeIntegerNegate (__int64 i) 53 { 54 return -i; 55 } 56 57 __int64 WINAPI 58 ConvertLongToLargeInteger (LONG l) 59 { 60 return (__int64) l; 61 } 62 63 __int64 WINAPI 64 ConvertUlongToLargeInteger (ULONG ul) 65 { 66 return _toi(_toui(ul)); 67 } 68 69 __int64 WINAPI 70 EnlargedIntegerMultiply (LONG l1, LONG l2) 71 { 72 return _toi(l1) * _toi(l2); 73 } 74 75 __int64 WINAPI 76 EnlargedUnsignedMultiply (ULONG ul1, ULONG ul2) 77 { 78 return _toi(_toui(ul1) * _toui(ul2)); 79 } 80 81 __int64 WINAPI 82 ExtendedIntegerMultiply (__int64 i, LONG l) 83 { 84 return i * _toi(l); 85 } 86 87 __int64 WINAPI 88 LargeIntegerMultiply (__int64 i1, __int64 i2) 89 { 90 return i1 * i2; 91 } 92 93 __int64 WINAPI LargeIntegerDivide (__int64 i1, __int64 i2, __int64 *remainder) 94 { 95 if (remainder) 96 *remainder = i1 % i2; 97 return i1 / i2; 98 } 99 100 ULONG WINAPI 101 EnlargedUnsignedDivide (unsigned __int64 i1, ULONG i2, PULONG remainder) 102 { 103 if (remainder) 104 *remainder = i1 % _toi(i2); 105 return i1 / _toi(i2); 106 } 107 __int64 WINAPI 108 ExtendedLargeIntegerDivide (__int64 i1, ULONG i2, PULONG remainder) 109 { 110 if (remainder) 111 *remainder = i1 % _toi(i2); 112 return i1 / _toi(i2); 113 } 114 115 /* FIXME: what is this function supposed to do? */ 116 __int64 WINAPI ExtendedMagicDivide (__int64 i1, __int64 i2, int n) 117 { 118 return 0; 119 } 120 #endif 121 122