public static DataType reconcileAppliedDataType(DataType originalDataType, DataType newDataType,
			boolean stackPointers) {
		if (newDataType == DataType.DEFAULT) {
			return newDataType;
		}

		DataType resultDt = newDataType;
		if (stackPointers && (newDataType instanceof Pointer) &&
			(originalDataType instanceof Pointer ptr)) {
			if (isDefaultPointer(newDataType)) {
				// When applying default-pointer to existing pointer replicate the outermost
				// pointer type to wrap existing pointer (e.g., char* becomes char**)
				resultDt = ptr.newPointer(ptr);
			}
		}
		else if (stackPointers && (originalDataType instanceof Pointer)) {
			// replace existing pointer's base data type
			resultDt = stackPointers((Pointer) originalDataType, newDataType);
		}
		else if (newDataType instanceof FunctionDefinition || (newDataType instanceof TypeDef &&
			((TypeDef) newDataType).getBaseDataType() instanceof FunctionDefinition)) {
			resultDt = new PointerDataType(newDataType);
		}
		return resultDt;
	}
Determine the final data-type which should be applied based upon a
user applied type of newDataType on an existing originalDataType.
Pointer conversion is performed when appropriate, otherwise the
newDataType is returned unchanged.
If newDataType is a FunctionDefinition, or Typedef to a FunctionDefinition, it will either be stacked
with the existing pointer if enabled/applicable, or will be converted to a pointer since
FunctionDefinitions may only been used in the form of a pointer.
Note that originalDataType and newDataType should be actual applied types.
(i.e., do not strip typedefs, pointers, arrays, etc.).
@param originalDataType existing data type onto which newDataTye is applied
@param newDataType new data-type being applied
@param stackPointers If true the following data type transformation will be performed:
<ul>
<li>If newDataType is a default pointer and the originalDataType
is a pointer the new pointer will wrap
the existing pointer thus increasing is 'depth'
(e.g., int * would become int ** when default pointer applied).
If the originalDataType is not a pointer the newDataType will be returned unchanged.
</li>
<li>If the originalDataType is any type of pointer the supplied newDatatype
will replace the pointer's base type (e.g., int * would become db * when
newDataType is {@link ByteDataType}).</li>
</ul>
<P>If false, only required transformations will be applied, Example:
if newDataType is a FunctionDefinitionDataType it will be transformed
to a pointer before being applied.
@return either a combined pointer data-type or the newDataType specified with any
required transformation
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/DataUtilities.java