ccmaths.h File Reference

(r1785/r751)

#include "xlong.h"
#include "fixed16.h"
#include "fixed.h"

Go to the source code of this file.

Defines

#define PI   3.14159265358979323846

Typedefs

typedef xlong XLONG
typedef fixed16 FIXED16
typedef fixed16 ANGLE
typedef XLONG XMILLIPOINT

Functions

BOOL InitMaths ()
 Initialises the maths class. Windows version tests for maths coprocessor. Also sets up maths exception vectors.
XLONG Mul (const INT32, const INT32)
 Multiplication of two 32-bit signed numbers (xlongs).
XLONG Asl (const INT32, UINT32)
 Performs arithmetic shift left.
XLONG Asr (const INT32, UINT32)
 Performs arithmetic shift right.
INT32 MulDiv32By32 (const INT32, const INT32, const INT32)
 Multiplies two 32-bit values and divides the result by another 32-bit value.
fixed16 Div32By32 (const INT32 a, const INT32 b)
XLONG CCAPI MakeXLong (const INT32)
 To convert an INT32 value to an xlong.
XLONG CCAPI MakeXLong (const double)
 To convert a double value to an xlong.


Define Documentation

#define PI   3.14159265358979323846
 

Definition at line 145 of file ccmaths.h.


Typedef Documentation

typedef fixed16 ANGLE
 

Definition at line 120 of file ccmaths.h.

typedef fixed16 FIXED16
 

Definition at line 116 of file ccmaths.h.

typedef xlong XLONG
 

Definition at line 115 of file ccmaths.h.

typedef XLONG XMILLIPOINT
 

Definition at line 121 of file ccmaths.h.


Function Documentation

XLONG Asl const INT32  value,
UINT32  shift
 

Performs arithmetic shift left.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
Parameters:
INT32 - value to be shifted [INPUTS] UINT32 - shift count
None [OUTPUTS]
Returns:
XLONG - shifted number.

Errors: None.

Definition at line 158 of file ccmaths.cpp.

00159 {   
00160     XLONG result;
00161     
00162     result = MakeXLong(value);
00163     
00164     return  (result << shift);
00165 
00166 }

XLONG Asr const INT32  value,
UINT32  shift
 

Performs arithmetic shift right.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
Parameters:
INT32 - value to be shifted [INPUTS] UINT32 - shift count
None [OUTPUTS]
Returns:
XLONG - shifted number.

Errors: None.

Definition at line 189 of file ccmaths.cpp.

00190 {   
00191     return ( XLONG(value) >> shift);
00192 }

fixed16 Div32By32 const INT32  a,
const INT32  b
[inline]
 

Definition at line 134 of file ccmaths.h.

00135 {
00136     fixed16 v( InternalDiv32by32( a, b ) );
00137     return v;
00138 }

BOOL InitMaths  ) 
 

Initialises the maths class. Windows version tests for maths coprocessor. Also sets up maths exception vectors.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
Parameters:
None. [INPUTS]
None [OUTPUTS]
Returns:
A Boolean if initialisation was ok.

Errors: None.

Definition at line 249 of file f16spec.cpp.

00250 {
00251 
00252     MathCoprocInstalled = IsMathCoprocInstalled();
00253 
00254     #if PENTIUM_TEST
00255     // now check for faulty Pentium
00256     if ( !IsFloatingPointBugFree() )
00257     {
00258         Error::SetError( _R(IDE_BAD_PENTIUM) );
00259         InformError();
00260     }
00261     #endif
00262 
00263     return TRUE;
00264 }          

XLONG CCAPI MakeXLong const double  operand  ) 
 

To convert a double value to an xlong.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h
Parameters:
double value to be converted. [INPUTS]
None. [OUTPUTS]
Returns:
an xlong value.

Errors: None.

Definition at line 263 of file ccmaths.cpp.

00264 {
00265     xlong result;
00266 
00267     DoubleToXlong(operand, result);
00268 
00269     return result;
00270 }

XLONG CCAPI MakeXLong const INT32  operand  ) 
 

To convert an INT32 value to an xlong.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h
Parameters:
Long value to be converted. [INPUTS]
None. [OUTPUTS]
Returns:
an xlong value.

Errors: None.

Definition at line 239 of file ccmaths.cpp.

00240 {
00241     return XLONG(operand);
00242 }

XLONG Mul const INT32  operand1,
const INT32  operand2
 

Multiplication of two 32-bit signed numbers (xlongs).

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
Parameters:
Two INT32 values [INPUTS]
See also:
Xlongasm.h
Parameters:
None [OUTPUTS]
Returns:
A reference to an xlong with result of multiplication.

Errors: None.

Definition at line 128 of file ccmaths.cpp.

00129 {
00130     XLONG result;
00131 
00132     XMul32(operand1, operand2, result);
00133 
00134     return result;
00135 }

INT32 MulDiv32By32 const INT32  operand1,
const INT32  operand2,
const INT32  operand3
 

Multiplies two 32-bit values and divides the result by another 32-bit value.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/5/93
See also:
Xlongasm.h
Parameters:
operand1 - multiplicand 1 [INPUTS] operand2 - multiplicand 2 operand3 - divisor
None [OUTPUTS]
Returns:
INT32 - result of multiply-divide.

Errors: None.

Definition at line 215 of file ccmaths.cpp.

00216 {
00217     return Mul32Div32( operand1, operand2, operand3 );
00218 }


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