replacement for fastled sqrt16() (#4426)
* added bitwise operation based sqrt16 - replacement for fastled, it is about 10% slower for numbers smaller 128 but faster for larger numbers. speed difference is irrelevant to WLED but it saves some flash. * updated to 32bit, improved for typical WLED use - making it 32bits allows for larger numbers - added another initial condition check for medium sized numbers - increased the "small number" optimization to larger numbers: the function is currently only used to calculate sqrt(x^2+y^2) which even for small segments is larger than the initially used 64, so optimizing for 1024 makes more sense, although the value is arbitrarily chosen
This commit is contained in:
@@ -552,6 +552,7 @@ float asin_t(float x);
|
||||
template <typename T> T atan_t(T x);
|
||||
float floor_t(float x);
|
||||
float fmod_t(float num, float denom);
|
||||
uint32_t sqrt32_bw(uint32_t x);
|
||||
#define sin_t sin_approx
|
||||
#define cos_t cos_approx
|
||||
#define tan_t tan_approx
|
||||
|
||||
Reference in New Issue
Block a user