fiatScalarCmovznzU64 function
fiatScalarCmovznzU64 is a single-word conditional move.
Postconditions: out1 = (if arg1 = 0 then arg2 else arg3)
Input Bounds:
arg1: 0x0 ~> 0x1
arg2: 0x0 ~> 0xffffffffffffffff
arg3: 0x0 ~> 0xffffffffffffffff
Output Bounds:
out1: 0x0 ~> 0xffffffffffffffff
Implementation
BigInt fiatScalarCmovznzU64(BigInt arg1, BigInt arg2, BigInt arg3) {
final BigInt x1 = arg1 * BigInt.parse('FFFFFFFFFFFFFFFF', radix: 16);
final BigInt x2 = ((x1 & arg3) | ((~x1) & arg2));
return x2;
}