Closed ImUrX closed 3 years ago
If you don't want to preserve the sign bit when you right shift you should convert to an unsigned integer type, do the right shift, and then convert back to a signed integer type. The cast
function from the bytemuck
crate is great for this, and the optimizer will sort it out very well.
As to wrapping, all the operations are wrapping in both dev and release builds. SIMD doesn't allow for easy overflow detection, which means that trying to panic on an overflow is not very realistic.
alright thanks for the suggestion on bytemuck
, i will have to read the docs on it
sad about the wrapping side, its a feature i like in rust, even tho i use wrapping a lot, panics for knowing that something is overflowing when you dont want that to happen is a good feature (this only happens in dev builds)
im wanting to do an unsigned right shift with an i64x2/4, should i simply convert the vector to an u64 vector?
another stupid question, why is wrapping not supported? from what i understand rust in dev builds panics by default if a number overflows/underflows, shouldnt the same happen in here?