private void encodeAddressSet(Encoder encoder, AddressSet addressSet) throws IOException {
		AddressRangeIterator iter = addressSet.getAddressRanges();
		while (iter.hasNext()) {
			AddressRange addrRange = iter.next();
			AddressSpace space = addrRange.getAddressSpace();
			long first = addrRange.getMinAddress().getOffset();
			long last = addrRange.getMaxAddress().getOffset();
			if (space.hasSignedOffset()) {
				long mask;
				if (space.getSize() < 64) {
					mask = 1;
					mask <<= space.getSize();
				}
				else {
					mask = 0;
				}
				mask -= 1;
				if (first < 0 && last >= 0) {	// Range crosses 0
					first &= mask;
					// Split out the piece coming before 0
					encoder.openElement(ELEM_RANGE);
					encoder.writeSpace(ATTRIB_SPACE, space);
					encoder.writeUnsignedInteger(ATTRIB_FIRST, first);
					encoder.writeUnsignedInteger(ATTRIB_LAST, mask);
					encoder.closeElement(ELEM_RANGE);
					// Reset first,last to be the piece coming after 0
					first = 0;
				}
				first &= mask;
				last &= mask;
			}
			encoder.openElement(ELEM_RANGE);
			encoder.writeSpace(ATTRIB_SPACE, space);
			encoder.writeUnsignedInteger(ATTRIB_FIRST, first);
			encoder.writeUnsignedInteger(ATTRIB_LAST, last);
			encoder.closeElement(ELEM_RANGE);
		}
	}
Encode this object to an output stream
@param encoder is the stream encoder
@param injectLibrary is a library containing any inject payloads associated with the model
@throws IOException for errors writing to the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/PrototypeModel.java