nfrechette/rtm

Optimize quat_ensure_positive_w

Closed this issue · 0 comments

A simple function but currently mostly scalar. If the [w] component is positive, the input is returned unchanged but otherwise we negate the whole quaternion. This could easily be achieved with masking the appropriate bit with a binary and with -0.0, broadcasting it on all lanes with shuffle to finally xor the bias.