diff --git a/Components/ClockReceiver.hpp b/Components/ClockReceiver.hpp index 88f9bdb53..24af16c57 100644 --- a/Components/ClockReceiver.hpp +++ b/Components/ClockReceiver.hpp @@ -11,8 +11,8 @@ template class WrappedInt { public: - WrappedInt(int l) : length_(l) {} - WrappedInt() : length_(0) {} + inline WrappedInt(int l) : length_(l) {} + inline WrappedInt() : length_(0) {} inline T &operator =(const T &rhs) { length_ = rhs.length_; @@ -69,8 +69,8 @@ template class WrappedInt { inline int as_int() const { return length_; } inline T divide(const T &divisor) { - T result(length_ / divisor); - length_ %= divisor; + T result(length_ / divisor.length_); + length_ %= divisor.length_; return result; } @@ -84,19 +84,19 @@ template class WrappedInt { /*! Describes an integer number of whole cycles — pairs of clock signal transitions. */ class Cycles: public WrappedInt { public: - Cycles(int l) : WrappedInt(l) {} - Cycles() : WrappedInt() {} - Cycles(const Cycles &cycles) : WrappedInt(cycles.length_) {} + inline Cycles(int l) : WrappedInt(l) {} + inline Cycles() : WrappedInt() {} + inline Cycles(const Cycles &cycles) : WrappedInt(cycles.length_) {} }; /*! Describes an integer number of half cycles — single clock signal transitions. */ class HalfCycles: public WrappedInt { public: - HalfCycles(int l) : WrappedInt(l) {} - HalfCycles() : WrappedInt() {} + inline HalfCycles(int l) : WrappedInt(l) {} + inline HalfCycles() : WrappedInt() {} - HalfCycles(const Cycles &cycles) : WrappedInt(cycles.as_int() << 1) {} - HalfCycles(const HalfCycles &half_cycles) : WrappedInt(half_cycles.length_) {} + inline HalfCycles(const Cycles &cycles) : WrappedInt(cycles.as_int() << 1) {} + inline HalfCycles(const HalfCycles &half_cycles) : WrappedInt(half_cycles.length_) {} }; /*! @@ -107,11 +107,11 @@ class HalfCycles: public WrappedInt { */ template class ClockReceiver { public: - void run_for(const Cycles &cycles) { + inline void run_for(const Cycles &cycles) { static_cast(this)->run_for(HalfCycles(cycles)); } - void run_for(const HalfCycles &half_cycles) { + inline void run_for(const HalfCycles &half_cycles) { int cycles = half_cycles.as_int() + half_cycle_carry; half_cycle_carry = cycles & 1; run_for(Cycles(cycles >> 1));