Skip to content

Commit

Permalink
Fix bswap for 1-byte types
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Jan 8, 2025
1 parent d8bf51d commit 45de37f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/simdvec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ for (op, constraint, llvmop) in UNARY_OPS
Vec($(llvmop)(x.data))
end

# Fix up bswap (see <https://github.com/eschnett/SIMD.jl/issues/122>):
# bswap for 1-byte types is a no-op
Base.bswap(x::Vec{<:Any, <:Union{Int8,UInt8}}) = x

Base.:+(v::Vec{<:Any, <:ScalarTypes}) = v
Base.:-(v::Vec{<:Any, <:IntegerTypes}) = zero(v) - v
Base.:-(v::Vec{<:Any, <:FloatingTypes}) = Vec(Intrinsics.fneg(v.data))
Expand Down

0 comments on commit 45de37f

Please sign in to comment.