30#define SINI_PERIOD 0x8000
31#define SINI_MAX 0x1000
32#define SINI_MIN -0x1000
42static inline __attribute__((always_inline))
46 static const int32_t qN = 13,
53 x = x * x >> (2 * qN - 14);
55 y = B - (x * C >> 14);
71 static const int32_t qN = 13;
73 int32_t c = x << (30 - qN);
74 int32_t y =
_ihelp(x - (1 << qN));
76 return c >= 0 ? y :-y;
88 static const int32_t qN = 13;
93 return c >= 0 ? y :-y;
102static inline unsigned sqrti(
unsigned x)
109 unsigned y0 = x >> 1;
110 unsigned y1 = (y0 + x / y0) >> 1;
114 y1 = (y0 + x / y0) >> 1;
128static 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.