I need an efficient way to select 2 largest integers from array of 4, preserving the order.
E.g. 1,4,3,5
-> 4,5
; 1,5,3,4
-> 5,4
What’s the efficient way to do it?
I.e., with minimum conditionals (comparisons), or using min
/max
(assuming min
/max
have dedicated HW instructions and are not conditionals).