Function consistenttime::ct_select_u64
[−]
[src]
pub extern fn ct_select_u64(flag: bool, x: u64, y: u64) -> u64
Optional swapping.
Allow to set a varible optionally at the same speed without branching, or changing speed.
Returns X if flag == True.
Returns Y if flag == False.
At compile time this becomes a CMOV. This is a brach. The branch misprediction cost is ~20cycles. And if this is incurred does not depend on the input, but the random state of our machine + quantum winds.
This should provide a consistent guarantee of speed.