#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)    ((in                                                                                                                                                                                                                                                                                                                        