public static Address getAddressValue(MemBuffer buf, int size, int shift,
			AddressSpace targetSpace) {

		if (size <= 0 || size > 8) {
			return null;
		}

		if (buf.getAddress() instanceof SegmentedAddress) {
			// not supported for segmented addresses
			return null;
		}

		byte[] bytes = new byte[size];
		if (buf.getBytes(bytes, 0) != size) {
			return null;
		}

		long val = DataConverter.getInstance(buf.isBigEndian()).getValue(bytes, size);

		val = val << shift;

		try {
			return targetSpace.getAddress(val, true);
		}
		catch (AddressOutOfBoundsException e) {
			// offset too large
		}
		catch (IllegalArgumentException iae) {
			// Do nothing... Tried to create an address that was too large
			// for the address space
			//
			// For example, trying to create a 56 bit pointer in a
			// 32 bit address space.
		}
		return null;
	}
Generate an address value based upon bytes stored at the specified buf location
@param buf memory buffer and stored pointer location
@param size pointer size in bytes
@param shift left shift amount
@param targetSpace address space for returned pointer
@return pointer value or null if unusable buf or data
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/ShiftedAddressDataType.java