From 096cd8cc832301896bc8f7548bfd6b3ea1911592 Mon Sep 17 00:00:00 2001 From: Pharap <2933055+Pharap@users.noreply.github.com> Date: Mon, 4 Jun 2018 14:38:00 +0100 Subject: [PATCH] Improve ternary consistency within Utils.h (#57) --- src/FixedPoints/Utils.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FixedPoints/Utils.h b/src/FixedPoints/Utils.h index 12181af..0d1cf6b 100644 --- a/src/FixedPoints/Utils.h +++ b/src/FixedPoints/Utils.h @@ -135,9 +135,9 @@ constexpr SFixed roundFixed(const SFixed & { using OutputType = SFixed; return - signbitFixed(value) - ? (value.getFraction() <= OutputType(0.5).getFraction()) ? floorFixed(value) : ceilFixed(value) - : (value.getFraction() >= OutputType(0.5).getFraction()) ? ceilFixed(value) : floorFixed(value); + signbitFixed(value) ? + ((value.getFraction() <= OutputType(0.5).getFraction()) ? floorFixed(value) : ceilFixed(value)) : + ((value.getFraction() >= OutputType(0.5).getFraction()) ? ceilFixed(value) : floorFixed(value)); } template< unsigned Integer, unsigned Fraction > @@ -182,7 +182,7 @@ constexpr SFixed nextafterFixed(const SFixed to) ? - ResultType::fromInternal(from.getInternal() - 1): + ResultType::fromInternal(from.getInternal() - 1) : to; } @@ -194,7 +194,7 @@ constexpr UFixed nextafterFixed(const UFixed to) ? - ResultType::fromInternal(from.getInternal() - 1): + ResultType::fromInternal(from.getInternal() - 1) : to; }