From 2c1e99858b51a4e24301e5abc37c4373a4e57916 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 17 Oct 2017 22:22:51 -0400 Subject: [PATCH] Fixed HalfCycles to allow conversion from Cycles without relying on undefined behaviour. Specifically: left shifting a negative number. --- ClockReceiver/ClockReceiver.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClockReceiver/ClockReceiver.hpp b/ClockReceiver/ClockReceiver.hpp index 097b1c6db..a6f41b5f9 100644 --- a/ClockReceiver/ClockReceiver.hpp +++ b/ClockReceiver/ClockReceiver.hpp @@ -161,7 +161,7 @@ class HalfCycles: public WrappedInt { inline HalfCycles(int l) : WrappedInt(l) {} inline HalfCycles() : WrappedInt() {} - inline HalfCycles(const Cycles cycles) : WrappedInt(cycles.as_int() << 1) {} + inline HalfCycles(const Cycles cycles) : WrappedInt(cycles.as_int() * 2) {} inline HalfCycles(const HalfCycles &half_cycles) : WrappedInt(half_cycles.length_) {} /// @returns The number of whole cycles completely covered by this span of half cycles.