Revert the asm fixmul stuff for now.
[kugel-rb.git] / apps / codecs / libatrac / fixp_math.h
blobb6621b6f1a92ddcd5010421f346946fe872bd029
1 #include <stdlib.h>
2 #include <inttypes.h>
4 /* Macros for converting between various fixed-point representations and floating point. */
5 #define ONE_16 (1L << 16)
6 #define fixtof64(x) (float)((float)(x) / (float)(1 << 16)) //does not work on int64_t!
7 #define ftofix32(x) ((int32_t)((x) * (float)(1 << 16) + ((x) < 0 ? -0.5 : 0.5)))
8 #define ftofix31(x) ((int32_t)((x) * (float)(1 << 31) + ((x) < 0 ? -0.5 : 0.5)))
9 #define fix31tof64(x) (float)((float)(x) / (float)(1 << 31))
11 /* Fixed point math routines for use in atrac3.c */
12 inline int32_t fixmul16(int32_t x, int32_t y);
13 inline int32_t fixmul31(int32_t x, int32_t y);
14 inline int32_t fixdiv16(int32_t x, int32_t y);
15 inline int32_t fastSqrt(int32_t n);