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

add minmax and minmax_position #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add minmax and minmax_position #9

wants to merge 1 commit into from

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.

2 participants