-
Notifications
You must be signed in to change notification settings - Fork 82
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
shift_elements_{left,right} #441
Conversation
Not to say we shouldn't have this function, but (devil's advocate) slices for example only have rotating elements, not shifting in default. You could technically use our already implemented SIMD rotates, and then another swizzle to insert the default values. Should this maybe shift in an arbitrary value, rather than Default? |
Ah, this PR came about because I wrote an extension trait to do this for an algorithm that needs to shift by one element to the left and continue on its merry way. The C code I was porting just used a single intrinsic for what amounts to the same thing, so that motivated me to look for it in portable SIMD's API. Perhaps also, adding an explicit shift_elements function might help users to stop and realize that the As to using If so, would that rule out things that are invalid as a const generic parameter like Happy to make whatever desired changes based upon your own design goals if you decide to keep this PR. |
no, it can just be a function argument, no need for it to be const. |
I have changed it to accept a |
Co-authored-by: Caleb Zulawski <[email protected]>
Co-authored-by: Caleb Zulawski <[email protected]>
This implementation was patterned after the pre-existing
rotate_elements_{left,right}
and is meant to supersede #112 from 2021. If this functionality is buried somewhere else in the API that I missed, please close with a note where I can find it.The tests pass and the assembly looked reasonable on x86.