1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-27 01:29:31 +00:00

Added a compound divide and convert.

This commit is contained in:
Thomas Harte 2017-08-02 07:21:21 -04:00
parent bda9441620
commit f7e66dea61

View File

@ -175,6 +175,17 @@ class HalfCycles: public WrappedInt<HalfCycles> {
length_ &= 1;
return result;
}
/*!
Severs from @c this the effect of dividing by @c divisor @c this will end up with
the value of @c this modulo @c divisor and @c divided by @c divisor is returned.
*/
inline Cycles divide_cycles(const Cycles &divisor) {
HalfCycles half_divisor = HalfCycles(divisor);
Cycles result(length_ / half_divisor.length_);
length_ %= half_divisor.length_;
return result;
}
};
/*!