Lokathor / wide

A crate to help you go wide. By which I mean use SIMD stuff.
https://docs.rs/wide
zlib License
300 stars 25 forks source link

Feature idea/request: `clamp` and `signum` #131

Open torokati44 opened 1 year ago

torokati44 commented 1 year ago

They came up in an algorithm I'm considering for SIMDification (https://github.com/ruffle-rs/h263-rs/pull/49), and perhaps they would came in handy for others as well - they are in f32 at least, after all... I have zero clue though, whether there are intrinsics for these in any platforms... (At least clamp can be done with min and max of course. EDIT: Come to think of it, signum is also just (x > 0) - (x < 0).)

Lokathor commented 1 year ago

These should be pretty easy to add! I'd be happy to merge a PR if you did one.

As you say, they don't need to be specific intrinsics (though that would help), just making them from smaller parts that already exist should work.

torokati44 commented 1 year ago

Unfortunately I don't think I have the capacity for a proper PR about this, sorry. :/ I'll leave the issue open in case someone picks it up later.