private static byte[] adjustBytes(Register baseRegister, byte[] bytes) {
		int oldSize = bytes.length;
		byte[] baseMask = baseRegister.getBaseMask();
		int newSize = baseMask.length * 2;
		if (oldSize == newSize) {
			return bytes.clone();
		}

		byte[] newBytes = new byte[newSize];

		boolean isContext = baseRegister.isProcessorContext();

		int oldFieldLen = bytes.length / 2;
		int newFieldLen = baseMask.length;

		int keepLen = (oldSize < newSize) ? oldFieldLen : newFieldLen;

		int oldValIndex;
		int newValIndex;
		int oldMaskIndex;
		int newMaskIndex;

		if (isContext) {
			// processor context is left justified
			oldValIndex = oldFieldLen;
			newValIndex = newFieldLen;
			oldMaskIndex = 0;
			newMaskIndex = 0;
		}
		else {
			oldValIndex = oldSize - keepLen;
			newValIndex = newSize - keepLen;
			oldMaskIndex = oldFieldLen - keepLen;
			newMaskIndex = newFieldLen - keepLen;
			// TODO: if growing and old mask is all ff's set new upper mask bits
		}

		int maskFill = newMaskIndex;

		for (int i = 0; i < keepLen; i++) {
			byte maskByte = bytes[oldMaskIndex++];
			if (maskByte != (byte) 0xff) {
				maskFill = 0;
			}
			newBytes[newValIndex++] = (byte) (bytes[oldValIndex++] & maskByte);
			newBytes[newMaskIndex++] = maskByte;
		}

		for (int i = 0; i < maskFill; i++) {
			newBytes[i] = (byte) 0xff;
		}

		return newBytes;
	}
Constructs a new RegisterValue object for the given register and the mask/value byte array
@param register the register associated with this value.  The register specifies which bits
int the total mask/value arrays are used for this register which may be a sub-register of
some larger register.  The byte[] always is sized for the largest Register that contains
the given register.
@param bytes the mask/value array - the first n/2 bytes are the mask and the last n/2 bytes
are the value bits.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/RegisterValue.java