Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stronger typing for SimdUnaryOp argument #606

Merged
merged 1 commit into from
Mar 2, 2025
Merged

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Mar 2, 2025

Revise signature of SimdUnaryOp::eval so that it specifies the element type in the SIMD vector. Casting between the generic type and the concrete type used by the ISA is still required, but is now safer as the cast prevents accidental changing of the element type.

A bonus is that it now becomes slightly easier to implement an operation for different element types via a macro, as only the element type needs to varied for each impl in many cases.

Part of #549.

Revise signature of `SimdUnaryOp::eval` so that it specifies the element type in
the SIMD vector. Casting between the generic type and the concrete type used by
the ISA is still required, but is now safer as the cast prevents accidental
changing of the element type.

A bonus is that it now becomes slightly easier to implement an operation for
different element types via a macro, as only the element type needs to varied
for each impl in many cases.
@robertknight robertknight merged commit f988960 into main Mar 2, 2025
2 checks passed
@robertknight robertknight deleted the unary-op-typing branch March 2, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant