xlong.cpp File Reference

(r1785/r1282)

#include "camtypes.h"

Go to the source code of this file.

Functions

 DECLARE_SOURCE ("$Revision: 1282 $")
xlong operator+ (const xlong &operand1, const xlong &operand2)
 Overloading the addition operator for XLONGs.
xlong operator+ (const xlong &operand1, INT32 operand2)
 Overloading the addition operator for XLONGs.
xlong operator- (const xlong &operand1, const xlong &operand2)
 Overloading the subtract operator for XLONGs.
xlong operator- (const xlong &operand1, INT32 operand2)
 Overloading the subtract operator for XLONGs.
xlong operator- (const xlong &input)
 Overloading the negation operator for XLONGs.
xlong operator * (const xlong &operand1, const xlong &operand2)
 Overloading the multiplication operator for XLONGs.
xlong operator * (const xlong &operand1, INT32 operand2)
 Overloading the multiplication operator for XLONGs.
xlong operator * (const xlong &operand1, FIXED16 operand2)
 Overloading the multiplication operator for XLONGs and FIXED16s.
xlong operator/ (const xlong &operand1, const xlong &operand2)
 Overloading the division operator for XLONGs.
xlong operator/ (const xlong &operand1, INT32 operand2)
 Overloading the division operator for XLONGs.
xlong operator/ (const xlong &operand1, const fixed16 &operand2)
 Overloading the division operator for XLONGs.
xlong operator>> (const xlong &operand, UINT32 shift)
 Overloading the >> operator to mean shift right for XLONGs.
xlong operator<< (const xlong &operand, UINT32 shift)
 Overloading the << operator to mean shift left for XLONGs.
xlongoperator *= (xlong &xl, fixed16 fix)
 Overloading the times-equals operator for XLONGs, multiplying by a fixed16.
INT32 operator== (const xlong &first, const xlong &second)
 Overloading the postfix equality operator for XLONGs.
INT32 operator== (const xlong &first, INT32 second)
 Overloading the postfix equality operator for XLONGs.
INT32 operator!= (const xlong &first, const xlong &second)
 Overloading the postfix inequality operator for XLONGs.
INT32 operator!= (const xlong &first, INT32 second)
 Overloading the postfix inequality operator for XLONGs.
INT32 operator< (const xlong &first, const xlong &second)
 Overloading the postfix less-than operator for XLONGs.
INT32 operator< (const xlong &first, INT32 second)
 Overloading the postfix less-than operator for XLONGs.
INT32 operator> (const xlong &first, const xlong &second)
 Overloading the postfix greater-than operator for XLONGs.
INT32 operator> (const xlong &first, INT32 second)
 Overloading the postfix greater-than operator for XLONGs.
INT32 operator<= (const xlong &first, const xlong &second)
 Overloading the postfix less-than--or-equal operator for XLONGs.
INT32 operator<= (const xlong &first, INT32 second)
 Overloading the postfix less-than--or-equal operator for XLONGs.
INT32 operator>= (const xlong &first, const xlong &second)
 Overloading the postfix greater-than--or-equal operator for XLONGs.
INT32 operator>= (const xlong &first, INT32 second)
 Overloading the postfix greater-than--or-equal operator for XLONGs.
void XlongAdd (const xlong &input1, const xlong &input2, xlong &result)
 64-bit signed addition
void XlongAddOne (const xlong &input, xlong &result)
void XlongSub (const xlong &input1, const xlong &input2, xlong &result)
 64-bit signed subtraction
void XlongSubOne (const xlong &input, xlong &result)
void XlongNegOne (xlong &arg)
 64-bit signed negation
INT32 Mul32Div32 (INT32 mul1, INT32 mul2, INT32 divisor)
 To avoid losing precision.
void XMul32 (INT32 mul1, INT32 mul2, xlong &result)
 To avoid losing precision.
void XMul64 (const xlong &m1, const xlong &m2, xlong &result)
 Private to ccmath.h. Primitive for operator overloading.
void XlongMulOne (const xlong &m, xlong &result)
void longToXlong (const INT32 input, xlong &result)
 Private to ccmath.h. Primitive for operator overloading.
INT32 XlongTolong (const xlong &input)
 Private to ccmath.cpp. Primitive for operator overloading.
void XlongAsl64 (const xlong &input, INT32 shift, xlong &result)
 Private to ccmath.cpp. Primitive for operator overloading.
void XlongAsl64One (INT32 shift, xlong &result)
void XlongAsr64 (const xlong &input, INT32 shift, xlong &result)
 Private to ccmath.cpp. Primitive for operator overloading.
void XlongAsr64One (INT32 shift, xlong &result)
INT32 XlongCmpGT (const xlong &first, const xlong &second)
 Private to ccmath.cpp. Primitive for operator overloading.
INT32 XlongCmpGE (const xlong &first, const xlong &second)
INT32 XlongCmpLT (const xlong &first, const xlong &second)
INT32 XlongCmpLE (const xlong &first, const xlong &second)
INT32 XlongCmpEQ (const xlong &first, const xlong &second)
INT32 XlongCmpNE (const xlong &first, const xlong &second)
void XlongIncrement (xlong &input)
 Private to ccmath.cpp. Primitive for operator overloading. This is much more efficient than calling Add with a 1 as a second parameter.
void XlongDecrement (xlong &input)
 Private to ccmath.cpp. Primitive for operator overloading. This is much more efficient than calling Sub with a 1 as a second parameter.
void XDiv64 (xlong &top, xlong &bottom, xlong &result)
 Private to ccmath.cpp. Primitive for operator overloading.
void XDiv64One (xlong &bottom, xlong &result)
void XlongToAscii (const xlong &arg, LPSTR dest)
 Display xlongs in meaningful format.
void XlongToUnicode (const xlong &arg, WCHAR *dest)
void XMatrixCalc (fixed16 fix1, const xlong &l1, fixed16 fix2, const xlong &l2, xlong &result)
 Matrix multiply primitive done using intermediate 128-bit results so full accuracy is maintained. Special cases are when fix1 or fix2 are 0.0 or 1.0 as multiplications may be avoided (NOT YET IMPLEMENTED) Note that the result is rounded to the nearest integer.
void XlongByFixed16One (xlong *x1, fixed16 fix)
 Multiplying without losing precision. Private function used by operator overloading on *=.
double XlongToDouble (const xlong &x)
 Conversion between types. Private to ccmaths.h which has a better interface on top of this.
void DoubleToXlong (const double arg, xlong &x)
 Conversion between types. Private to ccmaths.h which has a better interface on top of this.


Function Documentation

DECLARE_SOURCE "$Revision: 1282 $"   ) 
 

void DoubleToXlong const double  arg,
xlong x
 

Conversion between types. Private to ccmaths.h which has a better interface on top of this.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/6/93
Parameters:
A double for conversion and a reference to an xlong (for the return [INPUTS] value).
Xlong reference is updated with new value [OUTPUTS]
Returns:
None

Errors: None (overflow ignored). No rounding. (I think). Scope: Private

Definition at line 2166 of file xlong.cpp.

02167 {
02168     x = (xlong)arg ;
02169 }

void longToXlong const INT32  input,
xlong result
 

Private to ccmath.h. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
32-bit signed INT32 [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None possible

Definition at line 1844 of file xlong.cpp.

01845 {
01846     result = input ;
01847 }

INT32 Mul32Div32 INT32  mul1,
INT32  mul2,
INT32  divisor
 

To avoid losing precision.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93 Scope: Private to Xlong class
Parameters:
two multiplicands, one divisor [INPUTS]
result of mul1*mul2/div using 64-bit intermediate result (signed) [OUTPUTS]
Returns:
INT32 result

Errors: If divisor zero or overflow will INT32 0 (div0)

Definition at line 1775 of file xlong.cpp.

01776 {
01777 //  return MulDiv(mul1,mul2,divisor) ;
01778     return INT32(((xlong)mul1*mul2)/divisor) ;
01779 }

xlong operator * const xlong operand1,
FIXED16  operand2
 

Overloading the multiplication operator for XLONGs and FIXED16s.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be multiplied togther. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of multiplication.

Errors: None.

Definition at line 464 of file xlong.cpp.

00465 {
00466     xlong temp = operand1;
00467 
00468     XlongByFixed16One( &temp, operand2 );           // more efficient to pass 1 ptr than 2
00469 
00470     return temp;
00471 }

xlong operator * const xlong operand1,
INT32  operand2
 

Overloading the multiplication operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be multiplied togther. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of multiplication.

Errors: None.

Definition at line 402 of file xlong.cpp.

00403 {
00404     xlong result = operand1;
00405     xlong temp;
00406     
00407     LongToXlong(operand2, temp);
00408 
00409     XMul64One(temp, result);
00410 
00411     return result;
00412 }

xlong operator * const xlong operand1,
const xlong operand2
 

Overloading the multiplication operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be multiplied togther. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of multiplication.

Errors: None.

Definition at line 373 of file xlong.cpp.

00374 {
00375     xlong result = operand1;
00376 
00377     XMul64One(operand2, result);
00378 
00379     return result;
00380 }

xlong& operator *= xlong xl,
fixed16  fix
 

Overloading the times-equals operator for XLONGs, multiplying by a fixed16.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/93
See also:
Xlongasm.h
Parameters:
multiplier - rhs of assignment. [INPUTS]
None. [OUTPUTS]
Returns:
A reference to an XLONG with result of assignment.

Errors: None (overflow ignored).

See also:
XlongByFixed16One

Definition at line 911 of file xlong.cpp.

00912 {
00913     XlongByFixed16One( &xl, fix );
00914     return xl;
00915 }

INT32 operator!= const xlong first,
INT32  second
 

Overloading the postfix inequality operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two valuess to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1272 of file xlong.cpp.

01273 { 
01274     xlong temp;
01275     
01276     LongToXlong(second, temp);
01277     
01278     return XlongCmpNE(first, temp); 
01279 }

INT32 operator!= const xlong first,
const xlong second
 

Overloading the postfix inequality operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1246 of file xlong.cpp.

01247 { 
01248     return XlongCmpNE(first, second); 
01249 }

xlong operator+ const xlong operand1,
INT32  operand2
 

Overloading the addition operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be added together. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of addition.

Errors: None.

Definition at line 191 of file xlong.cpp.

00192 {
00193     xlong result = operand1;
00194     xlong temp;
00195     
00196     LongToXlong(operand2, temp);
00197     
00198     XlongAddOne(temp, result);
00199 
00200     return result;
00201 }

xlong operator+ const xlong operand1,
const xlong operand2
 

Overloading the addition operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be added together. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of addition.

Errors: None.

Definition at line 161 of file xlong.cpp.

00162 {
00163     xlong result = operand1;
00164 
00165     XlongAddOne(operand2, result);
00166 
00167     return result;
00168 }

xlong operator- const xlong input  ) 
 

Overloading the negation operator for XLONGs.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Value for negation. [INPUTS]
None. [OUTPUTS]
Returns:
The negated value.

Errors: None.

Definition at line 345 of file xlong.cpp.

00346 {
00347     xlong temp;
00348 
00349     XlongNegOne( temp = input );
00350     return temp;
00351 }

xlong operator- const xlong operand1,
INT32  operand2
 

Overloading the subtract operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be subtracted from each other. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of subtraction.

Errors: None.

Definition at line 285 of file xlong.cpp.

00286 {
00287     xlong result = operand1;
00288     xlong temp;
00289     
00290     LongToXlong(operand2, temp);
00291 
00292     XlongSubOne(temp, result);
00293 
00294     return result;
00295 }

xlong operator- const xlong operand1,
const xlong operand2
 

Overloading the subtract operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be subtracted from each other. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of subtraction.

Errors: None.

Definition at line 256 of file xlong.cpp.

00257 {
00258     xlong result = operand1;
00259 
00260     XlongSubOne(operand2, result);
00261 
00262     return result;
00263 }

xlong operator/ const xlong operand1,
const fixed16 operand2
 

Overloading the division operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93 Friend: XLONG
See also:
Xlongasm.h
Parameters:
Two values to be divided. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of division.

Errors: None.

Definition at line 590 of file xlong.cpp.

00591 {
00592     xlong result;
00593     
00594     result = operand1;
00595 
00596 //  XlongByFixed16One(&result, operand2);
00597     ENSURE( FALSE, "You are using the XLONG / operator which actually multiplies!" );
00598 
00599     return result;
00600 }

xlong operator/ const xlong operand1,
INT32  operand2
 

Overloading the division operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be divided. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of division.

Errors: None.

Definition at line 524 of file xlong.cpp.

00525 {
00526     xlong result = operand1;
00527     xlong temp;
00528     
00529     LongToXlong(operand2, temp);
00530 
00531     XDiv64One(temp, result);
00532 
00533     return result;
00534 }

xlong operator/ const xlong operand1,
const xlong operand2
 

Overloading the division operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be divided. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of division.

Errors: None.

Definition at line 495 of file xlong.cpp.

00496 {
00497     xlong result = operand1;
00498 
00499     XDiv64One(operand2, result);
00500 
00501     return result;
00502 }

INT32 operator< const xlong first,
INT32  second
 

Overloading the postfix less-than operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1358 of file xlong.cpp.

01359 { 
01360     xlong temp;
01361     
01362     LongToXlong(second, temp);
01363     
01364     return XlongCmpLT(first, temp); 
01365 }

INT32 operator< const xlong first,
const xlong second
 

Overloading the postfix less-than operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1332 of file xlong.cpp.

01333 { 
01334     return XlongCmpLT(first, second); 
01335 }

xlong operator<< const xlong operand,
UINT32  shift
 

Overloading the << operator to mean shift left for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
operand - shift count. [INPUTS]
None. [OUTPUTS]
Returns:
An XLONG with result of ASL.

Errors: None.

Definition at line 654 of file xlong.cpp.

00655 {
00656     xlong result = operand;
00657 
00658     XlongAsl64One(shift, result);
00659 
00660     return result;
00661 }

INT32 operator<= const xlong first,
INT32  second
 

Overloading the postfix less-than--or-equal operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1530 of file xlong.cpp.

01531 { 
01532     xlong temp;
01533     
01534     LongToXlong(second, temp);
01535     
01536     return XlongCmpLE(first, temp); 
01537 }

INT32 operator<= const xlong first,
const xlong second
 

Overloading the postfix less-than--or-equal operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1504 of file xlong.cpp.

01505 { 
01506     return XlongCmpLE(first, second); 
01507 }

INT32 operator== const xlong first,
INT32  second
 

Overloading the postfix equality operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1186 of file xlong.cpp.

01187 {                                 
01188     xlong temp;
01189     
01190     LongToXlong(second, temp);
01191     
01192     return XlongCmpEQ(first, temp); 
01193 }

INT32 operator== const xlong first,
const xlong second
 

Overloading the postfix equality operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1160 of file xlong.cpp.

01161 { 
01162     return XlongCmpEQ(first, second); 
01163 }

INT32 operator> const xlong first,
INT32  second
 

Overloading the postfix greater-than operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1444 of file xlong.cpp.

01445 { 
01446     xlong temp;
01447     
01448     LongToXlong(second, temp);
01449     
01450     return XlongCmpGT(first, temp); 
01451 }

INT32 operator> const xlong first,
const xlong second
 

Overloading the postfix greater-than operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1418 of file xlong.cpp.

01419 { 
01420     return XlongCmpGT(first, second); 
01421 }

INT32 operator>= const xlong first,
INT32  second
 

Overloading the postfix greater-than--or-equal operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two values to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1616 of file xlong.cpp.

01617 { 
01618     xlong temp;
01619     
01620     LongToXlong(second, temp);
01621     
01622     return XlongCmpGE(first, temp); 
01623 }

INT32 operator>= const xlong first,
const xlong second
 

Overloading the postfix greater-than--or-equal operator for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
Two XLONGs to be compared [INPUTS]
None. [OUTPUTS]
Returns:
Integer - 0 = False 1 = True

Errors: None.

Definition at line 1590 of file xlong.cpp.

01591 { 
01592     return XlongCmpGE(first, second); 
01593 }

xlong operator>> const xlong operand,
UINT32  shift
 

Overloading the >> operator to mean shift right for XLONGs.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
See also:
Xlongasm.h Friend: XLONG
Parameters:
operand1 - value to be shifted. [INPUTS] operand2 - shift count.
None. [OUTPUTS]
Returns:
An XLONG with result of ASR.

Errors: None.

Definition at line 625 of file xlong.cpp.

00626 {
00627     xlong result = operand;
00628 
00629     XlongAsr64One(shift, result);
00630 
00631     return result;
00632 }

void XDiv64 xlong top,
xlong bottom,
xlong result
 

Private to ccmath.cpp. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/93 Scope: Private to Xlong class
Parameters:
two 64-bit signed xlong [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None (underflow ignored). Div0 will take exception

Definition at line 2039 of file xlong.cpp.

02040 {
02041     result = top/bottom ;
02042 }

void XDiv64One xlong bottom,
xlong result
 

Definition at line 2044 of file xlong.cpp.

02045 {
02046     result /= bottom ;
02047 }

void XlongAdd const xlong input1,
const xlong input2,
xlong result
 

64-bit signed addition

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/4/93 Scope: Private to Xlong class
Parameters:
[INPUTS] 
pointer to the xlong result [OUTPUTS]
Returns:
None

Errors: None (no overflow checks)

Definition at line 1698 of file xlong.cpp.

01699 {
01700     result = input1+input2 ;
01701 }

void XlongAddOne const xlong input,
xlong result
 

Definition at line 1703 of file xlong.cpp.

01704 {
01705     result += input ;
01706 }

void XlongAsl64 const xlong input,
INT32  shift,
xlong result
 

Private to ccmath.cpp. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong, INT32 shift count [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None (overflow ignored). The shift count is masked with 3F for compatibility with normal Intel shifts

Definition at line 1889 of file xlong.cpp.

01890 {
01891     result = input<<shift ;
01892 }

void XlongAsl64One INT32  shift,
xlong result
 

Definition at line 1894 of file xlong.cpp.

01895 {
01896     result <<= shift ;
01897 }

void XlongAsr64 const xlong input,
INT32  shift,
xlong result
 

Private to ccmath.cpp. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong, INT32 shift count [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None (overflow ignored). The shift count is masked with 3F for compatibility with normal Intel shifts

Definition at line 1917 of file xlong.cpp.

01918 {
01919     result = input>>shift ;
01920 }

void XlongAsr64One INT32  shift,
xlong result
 

Definition at line 1922 of file xlong.cpp.

01923 {
01924     result >>= shift ;
01925 }

void XlongByFixed16One xlong x1,
fixed16  fix
 

Multiplying without losing precision. Private function used by operator overloading on *=.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/93
Parameters:
An Xlong (which will be modified) and a FIXED16. [INPUTS]
None [OUTPUTS]
Returns:
Xlong result of x1 * fix

Errors: None (overflow ignored). Scope: Private

Definition at line 2123 of file xlong.cpp.

02124 {
02125     *x1 = xlong( ( (double)*x1 * fix.all ) / ( 1 << 16 ) );
02126 }

INT32 XlongCmpEQ const xlong first,
const xlong second
 

Definition at line 1970 of file xlong.cpp.

01971 {
01972     return first==second ;
01973 }

INT32 XlongCmpGE const xlong first,
const xlong second
 

Definition at line 1955 of file xlong.cpp.

01956 {
01957     return first>=second ;
01958 }

INT32 XlongCmpGT const xlong first,
const xlong second
 

Private to ccmath.cpp. Primitive for operator overloading.

.. = comparison operator, one of: GT > GE >= LT < LE <= EQ == NE !=

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
two xlongs [INPUTS]
returns 1 if comparison true, else 0 [OUTPUTS]
Returns:
none

Errors: None

Definition at line 1950 of file xlong.cpp.

01951 {
01952     return first>second ;
01953 }

INT32 XlongCmpLE const xlong first,
const xlong second
 

Definition at line 1965 of file xlong.cpp.

01966 {
01967     return first<=second ;
01968 }

INT32 XlongCmpLT const xlong first,
const xlong second
 

Definition at line 1960 of file xlong.cpp.

01961 {
01962     return first<second ;
01963 }

INT32 XlongCmpNE const xlong first,
const xlong second
 

Definition at line 1975 of file xlong.cpp.

01976 {
01977     return first!=second ;
01978 }

void XlongDecrement xlong input  ) 
 

Private to ccmath.cpp. Primitive for operator overloading. This is much more efficient than calling Sub with a 1 as a second parameter.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None (underflow ignored).

Definition at line 2017 of file xlong.cpp.

02018 {
02019     input-- ;
02020 }

void XlongIncrement xlong input  ) 
 

Private to ccmath.cpp. Primitive for operator overloading. This is much more efficient than calling Add with a 1 as a second parameter.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong [INPUTS]
64-bit signed xlong [OUTPUTS]
Returns:
none

Errors: None (overflow ignored).

Definition at line 1996 of file xlong.cpp.

01997 {
01998     input++ ;
01999 }

void XlongMulOne const xlong m,
xlong result
 

Definition at line 1824 of file xlong.cpp.

01825 {
01826     result *= m ;
01827 }

void XlongNegOne xlong arg  ) 
 

64-bit signed negation

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/4/93 Scope: Private to Xlong class
Parameters:
pointer to value requiring negation [INPUTS]
contents of pointer pointer updated [OUTPUTS]
Returns:
None

Errors: None (no overflow checks)

Definition at line 1754 of file xlong.cpp.

01755 {
01756     arg = -arg ;
01757 }

void XlongSub const xlong input1,
const xlong input2,
xlong result
 

64-bit signed subtraction

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/4/93 Scope: Private to Xlong class
Parameters:
[INPUTS] 
pointer to the xlong result (input1 - input2) or (result-=input) [OUTPUTS]
Returns:
None

Errors: None (no overflow checks)

Most of the overhead is in extracting the parameters from the pointers so this does *not* use macros to hide memory models etc

Definition at line 1728 of file xlong.cpp.

01729 {
01730     result = input1-input2 ;
01731 }

void XlongSubOne const xlong input,
xlong result
 

Definition at line 1733 of file xlong.cpp.

01734 {
01735     result -= input ;
01736 }

void XlongToAscii const xlong arg,
LPSTR  dest
 

Display xlongs in meaningful format.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong [INPUTS]
ASCII string, optional - sign then up to 20 digits, then null byte [OUTPUTS]
Returns:
none

Errors: None

Definition at line 2066 of file xlong.cpp.

02067 {
02068 #if defined(__WXMSW__)
02069     sprintf(dest,"%I64i",arg) ;
02070 #else
02071     sprintf(dest,"%lld",arg) ;
02072 #endif
02073 }

double XlongToDouble const xlong x  ) 
 

Conversion between types. Private to ccmaths.h which has a better interface on top of this.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/6/93
Parameters:
An Xlong [INPUTS]
None [OUTPUTS]
Returns:
A double-precision value

Errors: None (overflow impossible, some precision may be lost) Scope: Private

Definition at line 2144 of file xlong.cpp.

02145 {
02146     return (double)x;
02147 }

INT32 XlongTolong const xlong input  ) 
 

Private to ccmath.cpp. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/93 Scope: Private to Xlong class
Parameters:
64-bit signed xlong [INPUTS]
32-bit signed INT32 [OUTPUTS]
Returns:
none

Errors: None (overflow ignored)

Definition at line 1865 of file xlong.cpp.

01866 {
01867     return (INT32)input ;
01868 }

void XlongToUnicode const xlong arg,
WCHAR dest
 

Definition at line 2075 of file xlong.cpp.

02076 {
02077 #if defined(__WXMSW__)
02078     swprintf( dest, 21, L"%I64i", arg );
02079 #else
02080     swprintf( dest, 21, L"%lld", arg );
02081 #endif
02082 }

void XMatrixCalc fixed16  fix1,
const xlong l1,
fixed16  fix2,
const xlong l2,
xlong result
 

Matrix multiply primitive done using intermediate 128-bit results so full accuracy is maintained. Special cases are when fix1 or fix2 are 0.0 or 1.0 as multiplications may be avoided (NOT YET IMPLEMENTED) Note that the result is rounded to the nearest integer.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/93 Scope: Private to Xlong class
Parameters:
two FIXED16s, two xlongs [INPUTS]
Result returns modified. (32-bit version is a macro). [OUTPUTS]
Returns:
Xlong result of fix1*l1 + fix2*l2

Errors: None (overflow ignored).

Definition at line 2102 of file xlong.cpp.

02103 {
02104     result = xlong(((double)l1*fix1.all+(double)l2*fix2.all)/(1<<16)) ;
02105 }

void XMul32 INT32  mul1,
INT32  mul2,
xlong result
 

To avoid losing precision.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93 Scope: Private to Xlong class
Parameters:
two 32-bit multiplicands [INPUTS]
signed 64-bit [OUTPUTS]
Returns:
none

Errors: None (no overflow checks)

Definition at line 1796 of file xlong.cpp.

01797 {
01798     result = (xlong)mul1*mul2 ;
01799 }

void XMul64 const xlong m1,
const xlong m2,
xlong result
 

Private to ccmath.h. Primitive for operator overloading.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93 Scope: Private to Xlong class
Parameters:
two 64-bit multiplicands [INPUTS]
signed 64-bit (m1*m2 or result*=m) [OUTPUTS]
Returns:
none

Errors: None (no overflow checks)

Definition at line 1819 of file xlong.cpp.

01820 {
01821     result = m1*m2 ;
01822 }


Generated on Sat Nov 10 03:49:24 2007 for Camelot by  doxygen 1.4.4