powerOfTwo function

int powerOfTwo (int exponent)

Raises 2 to the provided integer exponent (0 < exponent).

Implementation

int powerOfTwo(int exponent) {
  if (exponent < 0 || exponent >= 63) {
    throw ArgumentError.value(
        exponent, 'exponent', messages.argumentNotNegative);
  }

  return 1 << exponent;
}