File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -191,15 +191,16 @@ function _round_to_nearest(quotient::T,
191
191
halfdivisor = divisor >> 1
192
192
# PERF Note: Only need the last bit to check iseven, and default iseven(Int256)
193
193
# allocates, so we truncate first.
194
- if iseven ((divisor % Int8)) && remainder == halfdivisor
194
+ _iseven (x) = (x & 0x1 ) == 0
195
+ if _iseven (divisor) && remainder == halfdivisor
195
196
# `:NearestTiesAway` will tie away from zero, e.g. -8.5 ->
196
197
# -9. `:NearestTiesUp` will always ties towards positive
197
198
# infinity. `:Nearest` will tie towards the nearest even
198
199
# integer.
199
200
if M == :NearestTiesAway
200
201
ifelse (quotient < zero (quotient), quotient, quotient + one (quotient))
201
202
elseif M == :Nearest
202
- ifelse (iseven (quotient), quotient, quotient + one (quotient))
203
+ ifelse (_iseven (quotient), quotient, quotient + one (quotient))
203
204
else
204
205
quotient + one (quotient)
205
206
end
You can’t perform that action at this time.
0 commit comments