public static void encodeAttributes(Encoder encoder, Address startAddr, Address endAddr)
			throws IOException {
		AddressSpace space = startAddr.getAddressSpace();
		long offset = startAddr.getOffset();
		long size = endAddr.getOffset() - offset + 1;

		if (space != endAddr.getAddressSpace()) {
			throw new IllegalArgumentException(
				"Range boundaries are not in the same address space");
		}
		if (size < 0) {
			throw new IllegalArgumentException("Start of range comes after end of range");
		}

		long last = offset + size - 1;
		boolean useFirst = (offset != 0);
		boolean useLast = (last != -1);
		encoder.writeSpace(ATTRIB_SPACE, space);
		if (useFirst) {
			encoder.writeUnsignedInteger(ATTRIB_FIRST, offset);
		}
		if (useLast) {
			encoder.writeUnsignedInteger(ATTRIB_LAST, last);
		}
	}
Encode a memory range, as "space", "first", and "last" attributes, for the current element,
to the stream.
@param encoder is the stream encoder
@param startAddr is the first address in the range
@param endAddr is the last address in the range
@throws IOException for errors in the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/AddressXML.java