@Override
	public int getMinimumPossibleLength() {
		lock.acquire();
		try {
			checkIsValid();
			initializeIfNeeded();
			if (valueMap.isEmpty()) {
				return 1;
			}
			long minValue = valueMap.firstKey();
			long maxValue = valueMap.lastKey();
			boolean hasNegativeValues = minValue < 0;

			// check the min and max values in this enum to see if they fit in 1 byte enum, then 
			// 2 byte enum, then 4 byte enum. If the min and max values fit, then all other values
			// will fit as well
			for (int size = 1; size < 8; size *= 2) {
				long minPossible = getMinPossibleValue(size, hasNegativeValues);
				long maxPossible = getMaxPossibleValue(size, hasNegativeValues);
				if (minValue >= minPossible && maxValue <= maxPossible) {
					return size;
				}
			}
			return 8;
		}
		finally {
			lock.release();
		}
	}
Database implementation for the enumerated data type.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/EnumDB.java