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,
191191 halfdivisor = divisor >> 1
192192 # PERF Note: Only need the last bit to check iseven, and default iseven(Int256)
193193 # allocates, so we truncate first.
194- if iseven ((divisor % Int8)) && remainder == halfdivisor
194+ _iseven (x) = (x & 0x1 ) == 0
195+ if _iseven (divisor) && remainder == halfdivisor
195196 # `:NearestTiesAway` will tie away from zero, e.g. -8.5 ->
196197 # -9. `:NearestTiesUp` will always ties towards positive
197198 # infinity. `:Nearest` will tie towards the nearest even
198199 # integer.
199200 if M == :NearestTiesAway
200201 ifelse (quotient < zero (quotient), quotient, quotient + one (quotient))
201202 elseif M == :Nearest
202- ifelse (iseven (quotient), quotient, quotient + one (quotient))
203+ ifelse (_iseven (quotient), quotient, quotient + one (quotient))
203204 else
204205 quotient + one (quotient)
205206 end
You can’t perform that action at this time.
0 commit comments