private static long genMask(int bitWidth, boolean isLong) {
        int maxBitWidth = isLong ? MAX_BITS_FOR_LONG : MAX_BITS_FOR_INT;
        if (bitWidth >= maxBitWidth) {
            // -1 is always ones (11111...1111). It covers all it can possibly can.
            return -1;
        }

        long mask = 0;
        for (int i = 0; i < bitWidth; i++) {
            mask <<= 1;
            mask |= 1;
        }
        return mask;
    }
\n");
        if (msbFirst) {
            fw.append(" * Packs from the Most Significant Bit first\n");
        } else {
            fw.append(" * Packs from the Least Significant Bit first\n");
        }
        fw.append(" * \n");
        fw.append(" * @author automatically generated\n");
        fw.append(" * @see ByteBasedBitPackingGenerator\n");
        fw.append(" *\n");
        fw.append("
indexr-codegen/src/main/java/io/indexr/vlt/codec/pack/PackingClassGen.java