Skip to content

Commit 47f768c

Browse files
author
Michael Abbott
committed
same type, and Unsigned method
1 parent 4ce2d6c commit 47f768c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/special/misc.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
@inline Base.fld(x::AbstractSIMD, y::AbstractSIMD) = div(promote(x,y)..., RoundDown)
66

7-
@inline function Base.div(x::AbstractSIMD{W1,T}, y::AbstractSIMD{W2,T}, ::RoundingMode{:Down}) where {W1,W2,T<:Integer}
7+
@inline function Base.div(x::AbstractSIMD{W,T}, y::AbstractSIMD{W,T}, ::RoundingMode{:Down}) where {W,T<:Integer}
88
d = div(x, y)
99
d - (signbit(x y) & (d * y != x))
1010
end
1111

12-
@inline Base.mod(x::AbstractSIMD{W1,T}, y::AbstractSIMD{W2,T}) where {W1,W2,T<:Integer} =
12+
@inline Base.mod(x::AbstractSIMD{W,T}, y::AbstractSIMD{W,T}) where {W,T<:Integer} =
1313
ifelse(y == -1, zero(x), x - fld(x, y) * y)
1414

15+
@inline Base.mod(x::AbstractSIMD{W,T}, y::AbstractSIMD{W,T}) where {W,T<:Unsigned} =
16+
rem(x, y)
17+
1518
@inline Base.mod(i::AbstractSIMD{<:Any,<:Integer}, r::AbstractUnitRange{<:Integer}) =
1619
mod(i-first(r), length(r)) + first(r)
1720

@@ -25,5 +28,5 @@ for (X,L,H) in Iterators.product(fill([:Any, :Missing, :AbstractSIMD], 3)...)
2528
end
2629
end
2730

28-
@inline Base.clamp(x::AbstractSIMD{<:Any, <:Integer}, r::AbstractUnitRange{<:Integer}) =
31+
@inline Base.clamp(x::AbstractSIMD{<:Any,<:Integer}, r::AbstractUnitRange{<:Integer}) =
2932
clamp(x, first(r), last(r))

0 commit comments

Comments
 (0)