public static byte[] getShiftedDirectAddressBytes(Program program, Address toAddress) {

		byte[] addressBytes = getDirectAddressBytes(program, toAddress);

		Memory memory = program.getMemory();
		boolean isBigEndian = memory.isBigEndian();

		DataConverter dataConverter;
		if (isBigEndian) {
			dataConverter = new BigEndianDataConverter();
		}
		else {
			dataConverter = new LittleEndianDataConverter();
		}

		byte[] shiftedAddressBytes = null;
		DataTypeManager dataTypeManager = program.getDataTypeManager();
		DataOrganization dataOrganization = dataTypeManager.getDataOrganization();
		int addressShiftAmount = dataOrganization.getPointerShift();
		if (addressShiftAmount != 0 && program.getDefaultPointerSize() == addressBytes.length) {
			long addrLong = toAddress.getAddressableWordOffset();
			long mask = (-1 >> addressShiftAmount) << addressShiftAmount;
			if ((addrLong & mask) == addrLong) { // make sure use of shift is valid
				shiftedAddressBytes = new byte[addressBytes.length];
				addrLong = addrLong >> addressShiftAmount;
				byte[] tmpBytes = new byte[8];
				dataConverter.getBytes(addrLong, tmpBytes);
				System.arraycopy(tmpBytes,
					isBigEndian ? (tmpBytes.length - addressBytes.length) : 0, shiftedAddressBytes,
					0, shiftedAddressBytes.length);
			}
		}

		return shiftedAddressBytes;
	}
returns shifted address bytes if they are different than un-shifted

@param program program
@param toAddress target address
@return shifted bytes, null if same as un-shifted
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMemoryUtil.java