00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 # include "incls/_precompiled.incl"
00025 # include "incls/_longInt.cpp.incl"
00026
00027 inline long_int::long_int() {}
00028
00029 long_int::long_int(unsigned int low, unsigned int high) {
00030 this->low = low;
00031 this->high = high;
00032 }
00033
00034 long_int::long_int(double value) {
00035 long_int result = double_conversion(value);
00036 low = result.low;
00037 high = result.high;
00038 }
00039
00040 long_int long_int::operator +(long_int arg) {
00041 long_int receiver = *this;
00042 long_int result;
00043 __asm {
00044 mov eax, receiver.low
00045 mov edx, receiver.high
00046 add eax, arg.low
00047 adc edx, arg.high
00048 mov result.low, eax
00049 mov result.high, edx
00050 }
00051 return result;
00052 }
00053
00054 long_int long_int::operator -(long_int arg) {
00055 long_int receiver = *this;
00056 long_int result;
00057 __asm {
00058 mov eax, receiver.low
00059 mov edx, receiver.high
00060 sub eax, arg.low
00061 sbb edx, arg.high
00062 mov result.low, eax
00063 mov result.high, edx
00064 }
00065 return result;
00066 }
00067
00068 double long_int::as_double() {
00069 long_int receiver = *this;
00070 double result;
00071 __asm {
00072 fild receiver
00073 fstp result
00074 }
00075 return result;
00076 }
00077
00078 long_int long_int::double_conversion(double value) {
00079 register long_int result;
00080 __asm {
00081 fld value
00082 fistp result
00083 }
00084 return result;
00085 }
00086