ctSelectInt static method

int ctSelectInt(
  1. int a,
  2. int b,
  3. bool choice
)

Implementation

static int ctSelectInt(int a, int b, bool choice) {
  final mask = choice ? -1 : 0; // 0 or -1
  final s = a ^ (mask & (a ^ b));
  assert(s == a || s == b);
  return s;
}