1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-07-29 23:24:43 +00:00

Fixed Time addition, added accumulation of distance into track into the disk drive, added a short circuit for LCM.

This commit is contained in:
Thomas Harte
2016-08-03 07:26:05 -04:00
parent 30f8b6baa4
commit 21f1fa37a4
4 changed files with 18 additions and 1 deletions

View File

@@ -49,9 +49,21 @@ struct Time {
{
Time result;
result.clock_rate = NumberTheory::least_common_multiple(clock_rate, other.clock_rate);
result.length = length * (clock_rate / result.clock_rate) + other.length * (other.clock_rate / result.clock_rate);
result.length = length * (result.clock_rate / clock_rate) + other.length * (result.clock_rate / other.clock_rate);
return result;
}
inline void set_zero()
{
length = 0;
clock_rate = 1;
}
inline void set_one()
{
length = 1;
clock_rate = 1;
}
};