Skip to content

Commit

Permalink
Define custom promote
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Jan 24, 2024
1 parent 96945b1 commit be50c94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VectorizationBase"
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
authors = ["Chris Elrod <[email protected]>"]
version = "0.21.65"
version = "0.21.66"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
9 changes: 9 additions & 0 deletions src/VectorizationBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ using LayoutPointers:
using Static
using Static: One, Zero, eq, ne, lt, le, gt, ge

@inline function promote(x::X, y::Y) where {X,Y}
T = promote_type(X, Y)
convert(T, x), convert(T, y)
end
@inline function promote(x::X, y::Y, z::Z) where {X,Y,Z}
T = promote_type(promote_type(X, Y), Z)
convert(T, x), convert(T, y), convert(T, z)
end

asbool(::Type{True}) = true
asbool(::Type{False}) = false
# TODO: see if `@inline` is good enough.
Expand Down

0 comments on commit be50c94

Please sign in to comment.