code: static final void put6Bit(final WritableMemory wmem, final int offsetBytes, final int slotNo,
        final int newValue) {
      final int startBit = slotNo * 6;
      final int shift = startBit & 0X7;
      final int byteIdx = (startBit >>> 3) + offsetBytes;
      final int valShifted = (newValue & 0X3F) << shift;
      final int curMasked = wmem.getShort(byteIdx) & (~(VAL_MASK_6 << shift));
      final short insert = (short) (curMasked | valShifted);
      wmem.putShort(byteIdx, insert);
    }
docs: works for both heap and direct