MCPcopy Create free account
hub / github.com/FastLED/FastLED / sin8

Function sin8

src/platforms/trig8.h:51–54  ·  view source on GitHub ↗

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).

Source from the content-addressed store, hash-verified

49// then use int_scale for proper u16→u8 downscale (bit-replication
50// rounding, not naive truncation).
51inline 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
56inline u8 cos8(u8 theta) { return sin8(theta + 64); }
57

Callers 8

cos8Function · 0.70
computeOneTwinkleMethod · 0.50
beat.hFile · 0.50
trig8.cppFile · 0.50
getFirePaletteIndexFunction · 0.50
rainbowWaveFunction · 0.50
getPaletteIndexFunction · 0.50

Calls 1

sin16Function · 0.70

Tested by

no test coverage detected