Skip to content

Commit

Permalink
fix introduced test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed May 25, 2022
1 parent 0d62954 commit 651d82c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/codegen/lowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,20 @@ end

@generated function of_same_size(::Type{T}, ::Type{S}, ::StaticInt{R}) where {T,S,R}
sizeof_S = sizeof(S)
if T <: Integer && sizeof(T) == 8
# sizeof(T) == 8 && max(..., 4) to maybe demote Int64 -> Int32
sizeof_T = sizeof(T)
if T <: Integer
# max(..., 4) to maybe demote Int64 -> Int32
# but otherwise, we're giving up too much with the demotion.
sizeof_S *= max(8 ÷ R, 4)
if T === Bool || sizeof_S < 8
# HACK: T === Bool, makes code work.
sizeof_S *= 8
else
sizeof_S *= max(8 ÷ R, 4)
end
# multiply by 8 for sake of following `==` comparison
sizeof_T *= 8
end
sizeof(T) == sizeof_S && return T
sizeof_T == sizeof_S && return T
# Tfloat = T <: Union{Float32,Float64}
if T <: Union{Float32,Float64}
sizeof_S 8 ? Float64 : Float32
Expand Down

2 comments on commit 651d82c

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/61047

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.112 -m "<description of version>" 651d82cc0eeb8722e14137fa2a02becfe9ae9ad3
git push origin v0.12.112

Please sign in to comment.