Skip to content

Conversation

@LaihoE
Copy link
Owner

@LaihoE LaihoE commented Jul 18, 2024

No description provided.


pub trait MinMaxSimd<'a, T>
where
T: PartialOrd + Ord + Copy,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Ord bound here prevents floats from being used (also in MaxSimd and MinSimd).

I'm not sure if it makes sense to mirror the traits with Float variants (for example, MinMaxFloatSimd), use declarative macros to implement functions, or something else.

Using declarative macros for the separate implementations like impl_minmax_integers!(u8, i8, ...) and impl_minmax_floats!(f32, f64) would allow for bringing in the appropriate trait for simd::num::SimdFloat in the latter impl while keeping the simplicity of the current implementation for integers.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry floats are coming! I just started with the non floats. Not sure how I'll go about it quite yet. Personally I'm not a huge rust macro fan but will see!

Copy link

@okaneco okaneco Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and take your time.

Personally I'm not a huge rust macro fan but will see!

I don't blame you, I'm not either 🙂

My own experience with portable_simd has been more concrete uses and not generic interfaces. This ended up being a more delicate design situation than I gave any thought to initially.

(Feel free to mark this as resolved, since I don't seem to be able to.)

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.

3 participants