largestPow2LessThan function

int largestPow2LessThan(
  1. int x
)

This computes the power of 2 less than x

Implementation

int largestPow2LessThan(int x) => pow(2, log2Ceil(x) - 1).toInt();