private long encodeAbsolute(Address addr, int indexOperation) {
		if (addr instanceof OldGenericNamespaceAddress) {
			return encodeOldNamespaceAddr((OldGenericNamespaceAddress) addr);
		}
		switch (addr.getAddressSpace().getType()) {
			case AddressSpace.TYPE_UNKNOWN:
				if (addr.isHashAddress()) {
					// 60-bit hash address
					return HASH_ADDR_TYPE_LONG | addr.getOffset();
				}
			case AddressSpace.TYPE_RAM:
			case AddressSpace.TYPE_CODE:
			case AddressSpace.TYPE_DELETED:
			case AddressSpace.TYPE_OTHER:
				int baseIndex = getBaseAddressIndex(addr, false, indexOperation);
				long offset;
				if (baseIndex < 0) {
					if (baseIndex == Integer.MIN_VALUE) {
						// base address not found
						return INVALID_ADDRESS_KEY;
					}
					baseIndex = -baseIndex - 1;
					if (indexOperation == INDEX_MATCH_OR_PREVIOUS) {
						// last address of previous base segment
						offset = MAX_OFFSET;
					}
					else if (indexOperation == INDEX_MATCH_OR_NEXT) {
						// first address of next base segment
						offset = 0;
					}
					else {
						throw new AssertException("unexpected negative base index");
					}
				}
				else {
					offset = addr.getOffset() & ADDR_OFFSET_MASK;
				}
				return ABSOLUTE_ADDR_TYPE_LONG | ((long) baseIndex << ADDR_OFFSET_SIZE) | offset;

			case AddressSpace.TYPE_VARIABLE:
				return VARIABLE_ADDR_TYPE_LONG | (addr.getOffset() & ADDR_OFFSET_MASK);

			case AddressSpace.TYPE_REGISTER:
				return REGISTER_ADDR_TYPE_LONG | (addr.getOffset() & ADDR_OFFSET_MASK);

			case AddressSpace.TYPE_STACK:
				return STACK_ADDR_TYPE_LONG | (addr.getOffset() & ADDR_OFFSET_MASK);

			case AddressSpace.TYPE_EXTERNAL:
				return EXTERNAL_ADDR_TYPE_LONG | (addr.getOffset() & ADDR_OFFSET_MASK);

			case AddressSpace.TYPE_NONE:
				if (addr == Address.EXT_FROM_ADDRESS) {
					return EXT_FROM_ADDRESS_LONG;
				}
				return INVALID_ADDRESS_KEY;
		}
		throw new IllegalArgumentException("Address type can not be encoded");
	}
Get absolute key encoding for the specified address
@param addr address
@param indexOperation see INDEX_CREATE, INDEX_MATCH, INDEX_MATCH_OR_NEXT or INDEX_MATCH_OR_PREVIOUS
@return address key or INVALID_ADDRESS_KEY if not found
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/map/AddressMapDB.java