rust-lang / portable-simd

The testing ground for the future of portable SIMD in Rust
Apache License 2.0
875 stars 79 forks source link

Add `abs_diff` function to `SimdInt` and `SimdUint` traits #429

Closed okaneco closed 1 month ago

okaneco commented 1 month ago

Implement abs_diff for signed and unsigned integer vectors

calebzulawski commented 1 month ago

Thank you! Can you move the test under the macros that generate all of the int/uint tests? That will allow the function to be fuzzed over all the types/lane counts/inputs. I think you can copy another test that takes 2 inputs.

calebzulawski commented 1 month ago

I think it would be the same as this: https://github.com/rust-lang/portable-simd/blob/283acf44cc889a159483c4805cf29c75d6c13735/crates/core_simd/tests/ops_macros.rs#L553

However, it should be under the signed and unsigned tests, not float.

okaneco commented 1 month ago

Thanks, I'll give that a try

okaneco commented 1 month ago

Removed the original test file I added Added the tests to impl_signed_tests and impl_unsigned_tests

With that advice, it was easy to add the tests

calebzulawski commented 1 month ago

Looks good, thanks!