44#ifndef OPENSNES_MATH_H
45#define OPENSNES_MATH_H
71#define FIX(x) ((fixed)((x) << 8))
83#define UNFIX(x) ((s16)((x) >> 8))
95#define UNFIX_ROUND(x) ((s16)(((x) + 128) >> 8))
102#define FIX_FRAC(x) ((u8)((x) & 0xFF))
115#define FIX_MAKE(i, f) ((fixed)(((i) << 8) | (f)))
static u16 b
Definition main.c:157
static u16 a
Definition main.c:157
signed short s16
16-bit signed integer (-32768 to 32767)
Definition types.h:50
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
fixed fixCos(u8 angle)
Get cosine value for angle.
Definition math.h:197
const u8 ease_quad_table[256]
256-byte quadratic easing LUT — i² normalised to [0, 255]
fixed fixClamp(fixed x, fixed min, fixed max)
Clamp value to range.
fixed fixSqrt(fixed x)
Square root in 8.8 fixed-point.
u16 div16(u16 dividend, u16 divisor)
Safe 16-bit division.
fixed fixLerp(fixed a, fixed b, u8 t)
Linear interpolation.
u8 ease_in_quad(u8 t)
Ease-in quadratic: t² curve, output [0, 255].
Definition math.h:415
u8 ease_out_quad(u8 t)
Ease-out quadratic: 1 - (1-t)² curve, output [0, 255].
Definition math.h:427
u16 sqrt16(u16 n)
Integer square root.
fixed fixAbs(fixed x)
Absolute value of fixed-point.
const s16 sine_table[256]
Get sine value for angle.
fixed fixMul(fixed a, fixed b)
Multiply two fixed-point values.
fixed fixSin(u8 angle)
Definition math.h:181
u8 atan2_8(s16 dy, s16 dx)
8-bit two-argument arctangent
s16 fixed
8.8 signed fixed-point type
Definition math.h:59
fixed fixDiv(fixed a, fixed b)
Divide two fixed-point values.
u16 mod16(u16 dividend, u16 divisor)
Get remainder of division.
u16 mul16(u16 a, u16 b)
Safe 16-bit multiplication.
static u16 angle
Rotation step index, 0..47.
Definition main.c:53