code: final long reversePart(long v, int maxBits) {
          long rest = v & (~((1L << maxBits) - 1));
          return rest | reverse(v, maxBits);
      }
docs: Touches only the specified bits - it does not zero out the higher bits (like reverse does).