Skip to content

Commit

Permalink
Cheaper iseven, to match isodd (#44)
Browse files Browse the repository at this point in the history
It seems that Base no longer defines iseven in terms of isodd.
  • Loading branch information
NHDaly authored Sep 16, 2024
1 parent 45f80a5 commit 55d637f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BitIntegers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ flipsign(x::T, y::T) where {T<:XBS} = flipsign_int(x, y)
# this doesn't catch flipsign(x::BBS, y::BBS), which is more specific in Base
flipsign(x::UBS, y::UBS) = flipsign_int(promote(x, y)...) % typeof(x)

# Cheaper isodd, to avoid BigInt. NOTE: Base.iseven is defined in terms of isodd.
# Cheaper isodd, to avoid BigInt.
isodd(a::XBI) = isodd(a % Int) # only depends on the final bit! :)

iseven(a::XBI) = iseven(a % Int) # only depends on the final bit! :)

# * arithmetic operations

Expand Down

0 comments on commit 55d637f

Please sign in to comment.