ctSelectBool static method

bool ctSelectBool(
  1. bool a,
  2. bool b,
  3. bool choice
)

Implementation

static bool ctSelectBool(bool a, bool b, bool choice) {
  final ai = a ? 1 : 0;
  final bi = b ? 1 : 0;
  final mask = choice ? -1 : 0; // 0 or -1
  final si = ai ^ (mask & (ai ^ bi));
  return si != 0;
}