home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
517a.lha
/
VFont_v2.0
/
include
/
vfont
/
fixpoint.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-09
|
800b
|
28 lines
#ifndef FIXPOINT_H
#define FIXPOINT_H
typedef long FIX;
typedef short SFIX;
#define FIXOFFSET 0x00010000L
#define FIXOFFSET2 0x00008000L
/* ((1L<<(sizeof(int)<<3))>>10) */
#define SMALLFIXOS (short)((1L<< ((sizeof(SFIX)<<3)-1))-1)
#define FixToInt(v) ((int)((v)/FIXOFFSET))
#define FixToFloat(v) (((float)(v))/((float)FIXOFFSET))
#define IntToFix(v) ((FIX)((v)*FIXOFFSET))
#define FloatToFix(v) ((FIX)((v)*((float)FIXOFFSET)))
#define SFixToInt(v) ((int)((v)/SMALLFIXOS))
#define SFixToFloat(v) (((float)(v))/((float)SMALLFIXOS))
#define IntToSFix(v) ((SFIX)((v)*SMALLFIXOS))
#define FloatToSFix(v) ((SFIX)((v)*((float)SMALLFIXOS)))
#define FixDiv(x,y) ((FIX)((LONG)((x)*FIXOFFSET)/(LONG)(y)))
#define FixMul(x,y) ((FIX)((x)*FIXOFFSET*(y)))
#endif