Skip to content

Commit d73822e

Browse files
fix: fix bug, reduce allocs
1 parent 03984b7 commit d73822e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/types.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ Base.isequal(a::WeakRef, b::BSImpl.Type) = isequal(a.value, b)
706706
const SYM_SALT = 0x4de7d7c66d41da43 % UInt
707707
const DIV_SALT = 0x334b218e73bbba53 % UInt
708708

709-
@generated function hash_somescalar(a, h::UInt)
709+
@inline @generated function hash_somescalar(a, h::UInt)
710710
@nospecialize a
711711
expr = Expr(:if)
712712
cur_expr = expr
@@ -758,6 +758,8 @@ function hash_bsimpl(s::BSImpl.Type{T}, h::UInt, full) where {T}
758758
BSImpl.Const(; val, hash) => begin
759759
if iszero(hash)
760760
h = s.hash = hash_somescalar(val, h)::UInt
761+
else
762+
h = hash
761763
end
762764
if full
763765
h = Base.hash(typeof(val), h)::UInt
@@ -1258,7 +1260,7 @@ function Div{T}(n, d, simplified; type = promote_symtype(/, symtype(n), symtype(
12581260
n = Const{T}(unwrap(n))
12591261
d = Const{T}(unwrap(d))
12601262

1261-
if !_numeric_or_arrnumeric_type(type)
1263+
if !(type <: Number)
12621264
_iszero(n) && return Const{T}(n)
12631265
_isone(d) && return Const{T}(n)
12641266
return BSImpl.Div{T}(n, d, simplified; type, kw...)

0 commit comments

Comments
 (0)