From a7855e8c98e83d29455f6b1ed5574e4ff86a1878 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 17 Jul 2020 23:18:41 -0400 Subject: [PATCH] Ensure float literals are floats. --- Storage/TimedEventLoop.cpp | 10 +++++----- Storage/TimedEventLoop.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Storage/TimedEventLoop.cpp b/Storage/TimedEventLoop.cpp index 2fa932ff9..b083ef060 100644 --- a/Storage/TimedEventLoop.cpp +++ b/Storage/TimedEventLoop.cpp @@ -69,16 +69,16 @@ void TimedEventLoop::set_next_event_time_interval(Time interval) { void TimedEventLoop::set_next_event_time_interval(float interval) { // Calculate [interval]*[input clock rate] + [subcycles until this event] - float float_interval = interval * float(input_clock_rate_) + subcycles_until_event_; + const float float_interval = interval * float(input_clock_rate_) + subcycles_until_event_; - // So this event will fire in the integral number of cycles from now, putting us at the remainder - // number of subcycles + // This event will fire in the integral number of cycles from now, putting us at the remainder + // number of subcycles. const Cycles::IntType addition = Cycles::IntType(float_interval); cycles_until_event_ += addition; - subcycles_until_event_ = fmodf(float_interval, 1.0); + subcycles_until_event_ = fmodf(float_interval, 1.0f); assert(cycles_until_event_ >= 0); - assert(subcycles_until_event_ >= 0.0); + assert(subcycles_until_event_ >= 0.0f); } Time TimedEventLoop::get_time_into_next_event() { diff --git a/Storage/TimedEventLoop.hpp b/Storage/TimedEventLoop.hpp index 88d80bf77..bc21e61ad 100644 --- a/Storage/TimedEventLoop.hpp +++ b/Storage/TimedEventLoop.hpp @@ -103,7 +103,7 @@ namespace Storage { private: Cycles::IntType input_clock_rate_ = 0; Cycles::IntType cycles_until_event_ = 0; - float subcycles_until_event_ = 0.0; + float subcycles_until_event_ = 0.0f; }; }