8-bit wrappers derived from 16-bit LUTs. sin16 returns i16 [-32768..32767], offset to u16 [0..65535], then use int_scale for proper u16→u8 downscale (bit-replication rounding, not naive truncation).
| 49 | // then use int_scale for proper u16→u8 downscale (bit-replication |
| 50 | // rounding, not naive truncation). |
| 51 | inline u8 sin8(u8 theta) FL_NOEXCEPT { |
| 52 | u16 unsigned_result = static_cast<u16>(sin16(static_cast<u16>(theta) << 8)) + 32768; |
| 53 | return fl::int_scale<u16, u8>(unsigned_result); |
| 54 | } |
| 55 | |
| 56 | inline u8 cos8(u8 theta) { return sin8(theta + 64); } |
| 57 |
no test coverage detected