fixed16.h File Reference

(r1785/r1261)

#include "fixed.h"

Go to the source code of this file.

Classes

class  fixed16

Defines

#define F16SHIFT   16
#define SHORT_FIXED(x)   ( ((INT32)(x)) << F16SHIFT )
#define F16ASSIGN(it)   it
#define F16ASSIGNTHIS   *this
#define FIXED16_DBL(d)   fixed16::FromRawLong((INT32)((d)*65536))

Functions

fixed16 operator+ (const fixed16 &operand1, const fixed16 &operand2)
fixed16 operator- (const fixed16 &operand1, const fixed16 &operand2)
fixed16 operator- (const fixed16 &operand)
fixed16 operator * (const fixed16 &operand1, const fixed16 &operand2)
fixed16 operator/ (const fixed16 &operand1, const fixed16 &operand2)
fixed16 operator>> (const fixed16 &operand1, UINT32 operand2)
fixed16 operator<< (const fixed16 &operand1, UINT32 operand2)
INT32 operator== (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator== (const fixed16 &operand1, const short operand2)
INT32 operator!= (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator!= (const fixed16 &operand1, const short operand2)
INT32 operator> (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator> (const fixed16 &operand1, const short operand2)
INT32 operator< (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator< (const fixed16 &operand1, const short operand2)
INT32 operator>= (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator>= (const fixed16 &operand1, const short operand2)
INT32 operator<= (const fixed16 &operand1, const fixed16 &operand2)
INT32 operator<= (const fixed16 &operand1, const short operand2)

Variables

const INT32 FIXED16_ONE = 0x10000L
 An FIXED16 is a signed 32-bit value with a binary point between bits 15 and 16. Its purpose is to represent 32-bit floating point numbers. FIXED16 is a fixed point number contained within a 32-bit longword. The high 16-bit half contains the integer part, the low half the fractional. (Intel implementations store this as the low half first in memory). The integer half ranges from -32768 to 32767, the fractional part from 0 to 65535/65536ths (1/65536th= 0.000015259, 65535/65536=0.999984741). For efficiency all primitives are written in assembly-language, though most are used transparently by operator overloading. No-one should include fixed16.h directly - always use ccmath.h. You should also never use the lower-case type 'fixed16' - always used 'FIXED16'.
const INT32 FIXED16_HALF = 0x08000L
CCAPI xlong
CCAPI String


Define Documentation

#define F16ASSIGN it   )     it
 

Definition at line 238 of file fixed16.h.

#define F16ASSIGNTHIS   *this
 

Definition at line 239 of file fixed16.h.

#define F16SHIFT   16
 

Definition at line 151 of file fixed16.h.

#define FIXED16_DBL  )     fixed16::FromRawLong((INT32)((d)*65536))
 

Note that all the comment blocks live in the cpp files so they get compiled in with the help compiler

Definition at line 250 of file fixed16.h.

#define SHORT_FIXED  )     ( ((INT32)(x)) << F16SHIFT )
 

Definition at line 154 of file fixed16.h.


Function Documentation

fixed16 operator * const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 376 of file fixed16.h.

00377 {
00378     fixed16 result;
00379     F16ASSIGN(result) = Fixed16Mul( operand1, operand2 );
00380     return result;
00381 }

INT32 operator!= const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 421 of file fixed16.h.

00422 {
00423     return operand1.all != SHORT_FIXED( operand2 );
00424 }

INT32 operator!= const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 416 of file fixed16.h.

00417 {
00418     return operand1.all != operand2.all;
00419 }

fixed16 operator+ const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 355 of file fixed16.h.

00356 {
00357     fixed16 result;
00358     result.all = operand1.all + operand2.all;
00359     return result;
00360 }

fixed16 operator- const fixed16 operand  )  [inline]
 

Definition at line 369 of file fixed16.h.

00370 {
00371     fixed16 temp;
00372     temp.all = -operand.all;
00373     return temp;
00374 }

fixed16 operator- const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 362 of file fixed16.h.

00363 {
00364     fixed16 result;
00365     result.all = operand1.all - operand2.all;
00366     return result;
00367 }

fixed16 operator/ const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 383 of file fixed16.h.

00384 {
00385     fixed16 result;
00386     F16ASSIGN(result) = Fixed16Div( operand1, operand2 );
00387     return result;
00388 }

INT32 operator< const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 441 of file fixed16.h.

00442 {
00443     return operand1.all < SHORT_FIXED( operand2 );
00444 }

INT32 operator< const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 436 of file fixed16.h.

00437 {
00438     return operand1.all < operand2.all;
00439 }

fixed16 operator<< const fixed16 operand1,
UINT32  operand2
[inline]
 

Definition at line 397 of file fixed16.h.

00398 {
00399     fixed16 result;
00400     
00401     result.all = operand1.all << operand2;
00402     
00403     return result;
00404 }

INT32 operator<= const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 461 of file fixed16.h.

00462 {
00463     return operand1.all <= SHORT_FIXED( operand2 );
00464 }

INT32 operator<= const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 456 of file fixed16.h.

00457 {
00458     return operand1.all <= operand2.all;
00459 }

INT32 operator== const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 411 of file fixed16.h.

00412 {
00413     return operand1.all == SHORT_FIXED( operand2 );
00414 }

INT32 operator== const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 406 of file fixed16.h.

00407 {
00408     return operand1.all == operand2.all;
00409 }

INT32 operator> const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 431 of file fixed16.h.

00432 {
00433     return operand1.all > SHORT_FIXED(operand2);
00434 }

INT32 operator> const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 426 of file fixed16.h.

00427 {
00428     return operand1.all > operand2.all;
00429 }

INT32 operator>= const fixed16 operand1,
const short  operand2
[inline]
 

Definition at line 451 of file fixed16.h.

00452 {
00453     return operand1.all >= SHORT_FIXED( operand2 );
00454 }

INT32 operator>= const fixed16 operand1,
const fixed16 operand2
[inline]
 

Definition at line 446 of file fixed16.h.

00447 {
00448     return operand1.all >= operand2.all;
00449 }

fixed16 operator>> const fixed16 operand1,
UINT32  operand2
[inline]
 

Definition at line 390 of file fixed16.h.

00391 {
00392     fixed16 result;
00393     result.all = operand1.all >> operand2;
00394     return result;
00395 }


Variable Documentation

const INT32 FIXED16_HALF = 0x08000L
 

Definition at line 134 of file fixed16.h.

const INT32 FIXED16_ONE = 0x10000L
 

An FIXED16 is a signed 32-bit value with a binary point between bits 15 and 16. Its purpose is to represent 32-bit floating point numbers. FIXED16 is a fixed point number contained within a 32-bit longword. The high 16-bit half contains the integer part, the low half the fractional. (Intel implementations store this as the low half first in memory). The integer half ranges from -32768 to 32767, the fractional part from 0 to 65535/65536ths (1/65536th= 0.000015259, 65535/65536=0.999984741). For efficiency all primitives are written in assembly-language, though most are used transparently by operator overloading. No-one should include fixed16.h directly - always use ccmath.h. You should also never use the lower-case type 'fixed16' - always used 'FIXED16'.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/1993
See also:
CCMaths.h

Fixedasm.h

Div32By32

Keyword FIXED16

Returns:
Errors: None.

Definition at line 133 of file fixed16.h.

class CCAPI String
 

Definition at line 140 of file fixed16.h.

class CCAPI xlong
 

Definition at line 137 of file fixed16.h.


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