protected SegmentedAddress getAddressInSegment(long flat, int preferredSegment) {
		if ((preferredSegment << 4) <= flat) {
			int off = (int) (flat - (preferredSegment << 4));
			if (off <= 0xffff) {
				return new SegmentedAddress(this, preferredSegment, off);
			}
		}
		return null;
	}
Given a flat address offset and a preferred segment, try
to create an address that maps to the offset and is in the segment. For
architectures like x86 real-mode, multiple address encodings can map to
the same flat address offset.  This method tries to select between the different
encodings.  If the flat offset cannot be encoded with the preferred segment,
null is returned.

@param flat is the flat offset
@param preferredSegment is the 16-bit preferred segment value
@return the segment encoded address or null
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/SegmentedAddressSpace.java