1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Adds a faster flushing HalfCycles -> Cycles conversion.

This commit is contained in:
Thomas Harte 2021-07-23 20:07:57 -04:00
parent 86c30769d9
commit 6216d53b1a

View File

@ -222,6 +222,15 @@ class HalfCycles: public WrappedInt<HalfCycles> {
return result;
}
/*!
Equivalent to @c divide_cycles(Cycles(1)) but faster.
*/
forceinline Cycles divide_cycles() {
const Cycles result(length_ >> 1);
length_ &= 1;
return result;
}
private:
friend WrappedInt;
void fill(Cycles &result) {