@@ -10,7 +10,7 @@ import .Base: *, +, -, /, <, <<, >>, >>>, <=, ==, >, >=, ^, (~), (&), (|), xor,
10
10
sum, trailing_zeros, trailing_ones, count_ones, tryparse_internal,
11
11
bin, oct, dec, hex, isequal, invmod, _prevpow2, _nextpow2, ndigits0zpb,
12
12
widen, signed, unsafe_trunc, trunc, iszero, isone, big, flipsign, signbit,
13
- sign, hastypemax, isodd, digits!
13
+ sign, hastypemax, isodd, digits!, hash, hash_integer
14
14
15
15
if Clong == Int32
16
16
const ClongMax = Union{Int8, Int16, Int32}
768
768
769
769
if Limb === UInt
770
770
# this condition is true most (all?) of the time, and in this case we can define
771
- # an optimized version of the above hash_integer(::Integer, ::UInt) method for BigInt
772
- # used e.g. for Rational{BigInt}
771
+ # an optimized version for BigInt of hash_integer (used e.g. for Rational{BigInt}),
772
+ # and of hash
773
+
774
+ using . Base: hash_uint
775
+
773
776
function hash_integer (n:: BigInt , h:: UInt )
774
777
GC. @preserve n begin
775
778
s = n. size
@@ -799,7 +802,7 @@ if Limb === UInt
799
802
limb <= typemin (Int) % UInt && return hash (- (limb % Int), h)
800
803
end
801
804
pow = trailing_zeros (x)
802
- nd = ndigits0z (x, 2 )
805
+ nd = Base . ndigits0z (x, 2 )
803
806
idx = _divLimb (pow) + 1
804
807
shift = _modLimb (pow) % UInt
805
808
upshift = BITS_PER_LIMB - shift
0 commit comments