Skip to content

Commit 096cd8c

Browse files
authored
Improve ternary consistency within Utils.h (#57)
1 parent 299199c commit 096cd8c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/FixedPoints/Utils.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ constexpr SFixed<Integer, Fraction> roundFixed(const SFixed<Integer, Fraction> &
135135
{
136136
using OutputType = SFixed<Integer, Fraction>;
137137
return
138-
signbitFixed(value)
139-
? (value.getFraction() <= OutputType(0.5).getFraction()) ? floorFixed(value) : ceilFixed(value)
140-
: (value.getFraction() >= OutputType(0.5).getFraction()) ? ceilFixed(value) : floorFixed(value);
138+
signbitFixed(value) ?
139+
((value.getFraction() <= OutputType(0.5).getFraction()) ? floorFixed(value) : ceilFixed(value)) :
140+
((value.getFraction() >= OutputType(0.5).getFraction()) ? ceilFixed(value) : floorFixed(value));
141141
}
142142

143143
template< unsigned Integer, unsigned Fraction >
@@ -182,7 +182,7 @@ constexpr SFixed<Integer, Fraction> nextafterFixed(const SFixed<Integer, Fractio
182182
(from < to) ?
183183
ResultType::fromInternal(from.getInternal() + 1) :
184184
(from > to) ?
185-
ResultType::fromInternal(from.getInternal() - 1):
185+
ResultType::fromInternal(from.getInternal() - 1) :
186186
to;
187187
}
188188

@@ -194,7 +194,7 @@ constexpr UFixed<Integer, Fraction> nextafterFixed(const UFixed<Integer, Fractio
194194
(from < to) ?
195195
ResultType::fromInternal(from.getInternal() + 1) :
196196
(from > to) ?
197-
ResultType::fromInternal(from.getInternal() - 1):
197+
ResultType::fromInternal(from.getInternal() - 1) :
198198
to;
199199
}
200200

0 commit comments

Comments
 (0)