wide icon indicating copy to clipboard operation
wide copied to clipboard

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

Open torokati44 opened this issue 1 year ago • 2 comments

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).)

torokati44 avatar Apr 09 '23 23:04 torokati44

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.

Lokathor avatar Apr 10 '23 02:04 Lokathor

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.

torokati44 avatar May 13 '23 09:05 torokati44