Skip to content

Commit be50c94

Browse files
committed
Define custom promote
1 parent 96945b1 commit be50c94

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "VectorizationBase"
22
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
33
authors = ["Chris Elrod <elrodc@gmail.com>"]
4-
version = "0.21.65"
4+
version = "0.21.66"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/VectorizationBase.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ using LayoutPointers:
9191
using Static
9292
using Static: One, Zero, eq, ne, lt, le, gt, ge
9393

94+
@inline function promote(x::X, y::Y) where {X,Y}
95+
T = promote_type(X, Y)
96+
convert(T, x), convert(T, y)
97+
end
98+
@inline function promote(x::X, y::Y, z::Z) where {X,Y,Z}
99+
T = promote_type(promote_type(X, Y), Z)
100+
convert(T, x), convert(T, y), convert(T, z)
101+
end
102+
94103
asbool(::Type{True}) = true
95104
asbool(::Type{False}) = false
96105
# TODO: see if `@inline` is good enough.

0 commit comments

Comments
 (0)