FastLED 3.10.6
Loading...
Searching...
No Matches

◆ canHitPhase()

bool fl::can_match_detail::canHitPhase ( fl::u32 effective_clock_hz,
fl::u16 max_ticks,
const NanosRange & window )
inline

Definition at line 54 of file can_match.cpp.hpp.

56 {
57 if (window.isUnspecified()) {
58 // No chipset constraint on this phase.
59 return true;
60 }
61 if (effective_clock_hz == 0u) {
62 return false;
63 }
64 const fl::u64 kBillion = 1000000000ULL;
65 const fl::u64 lo_num = static_cast<fl::u64>(window.min_ns) * effective_clock_hz;
66 const fl::u64 hi_num = static_cast<fl::u64>(window.max_ns) * effective_clock_hz;
67 // ceil(lo_num / kBillion) — divide-and-round-up without overflow.
68 fl::u64 n_lo_64 = (lo_num + kBillion - 1ULL) / kBillion;
69 fl::u64 n_hi_64 = hi_num / kBillion;
70 if (n_lo_64 < 1ULL) {
71 n_lo_64 = 1ULL;
72 }
73 if (n_lo_64 > n_hi_64) {
74 return false;
75 }
76 if (max_ticks != 0u && n_lo_64 > static_cast<fl::u64>(max_ticks)) {
77 return false;
78 }
79 return true;
80}
constexpr bool isUnspecified() const FL_NO_EXCEPT

References fl::FL_NO_EXCEPT.

Referenced by isClocklessTimingCompatible().

+ Here is the caller graph for this function: