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

Function test_divide_impl

tests/fl/math/fixed_point.cpp:472–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470
471template<typename T>
472void test_divide_impl() {
473 T a(6.0f), b(3.0f);
474 T c = a / b;
475 FL_CHECK_EQ(c.to_int(), 2);
476
477 // Divide by 1 = identity
478 T one(1.0f);
479 FL_CHECK_EQ((a / one).raw(), a.raw());
480
481 // 1.0 / 2.0 = 0.5
482 using R = raw_t<T>;
483 T half = one / T(2.0f);
484 FL_CHECK_EQ(half.raw(), R(1) << (T::FRAC_BITS - 1));
485}
486
487template<typename T>
488void test_scalar_multiply_impl() {

Callers

nothing calls this directly

Calls 3

TEnum · 0.85
to_intMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected