setBottomBits static method

int setBottomBits(
  1. int? numBits
)

Returns an int with the given numBits set at the bottom.

Implementation

static int setBottomBits(int? numBits) {
  if (numBits == 0) return 0;

  var i = 1;

  for (int x = 1; x < numBits!; x++) {
    i = (i << 1) | 1;
  }

  return i;
}