From 55d637fb515ec3c5e72e53c043e98d23ade0c211 Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Mon, 16 Sep 2024 07:38:42 -0600 Subject: [PATCH] Cheaper iseven, to match isodd (#44) It seems that Base no longer defines iseven in terms of isodd. --- src/BitIntegers.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BitIntegers.jl b/src/BitIntegers.jl index 28d5893..860067d 100644 --- a/src/BitIntegers.jl +++ b/src/BitIntegers.jl @@ -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