static popcnt(i) {
        if (i < 0) {
            return Math.POSITIVE_INFINITY;
        }
        let t = 0;
        while (i > 0) {
            i &= i - 1;
            t++;
        }
        return t;
    }
Counts the number of set bits in an integer.

@param {!int} i
@returns {!int}