29#define SINI_PERIOD 0x8000
30#define SINI_MAX 0x1000
31#define SINI_MIN -0x1000
41static inline __attribute__((always_inline))
45 static const int32_t qN = 13,
52 x = x * x >> (2 * qN - 14);
54 y = B - (x * C >> 14);
70 static const int32_t qN = 13;
72 int32_t c = x << (30 - qN);
73 int32_t y =
_ihelp(x - (1 << qN));
75 return c >= 0 ? y :-y;
87 static const int32_t qN = 13;
92 return c >= 0 ? y :-y;
101static inline unsigned sqrti(
unsigned x)
108 unsigned y0 = x >> 1;
109 unsigned y1 = (y0 + x / y0) >> 1;
113 y1 = (y0 + x / y0) >> 1;
127static inline uint32_t
powi(
unsigned x,
unsigned y)
static int32_t fast_sini(int32_t x)
A sine approximation via a fourth-order cosine approx.
static uint32_t powi(unsigned x, unsigned y)
Returns the value of x to the power of y.
static unsigned sqrti(unsigned x)
Square root of an integer.
static int32_t _ihelp(int32_t x)
Internal fast_sini/fast_cosi helper function.
#define SINI_PERIOD
Period of the fast_sini() function.
static int32_t fast_cosi(int32_t x)
A a fourth-order cosine approx.