private void insertMinimalStructurePadding(int nextComponentOffset, DataType dt) {

		if (!isStructureContainer()) {
			throw new IllegalStateException();
		}

		int structLen = getMinimumPackedStructureLength();
		if (nextComponentOffset <= structLen) {
			return;
		}

		if (dt instanceof AbstractIntegerDataType) {
			largestPrimitiveSize = Math.max(largestPrimitiveSize, dt.getLength());
		}

		Structure struct = (Structure) memberDataType;

		int fillSpace = nextComponentOffset - structLen;
		while (fillSpace > 0) {

			int alignedOffset = DataOrganizationImpl.getAlignedOffset(dt.getAlignment(), structLen);
			if (alignedOffset == nextComponentOffset) {
				return;
			}

			DataType paddingDt = getPaddingDataType(nextComponentOffset, structLen);
			if (paddingDt == null) {
				return;
			}

			int paddingOffset =
				DataOrganizationImpl.getAlignedOffset(paddingDt.getAlignment(), structLen);
			struct.insertAtOffset(paddingOffset, paddingDt, -1, PADDING_COMPONENT_NAME, null);
			hasStructurePadding = true;

			structLen = struct.getLength();
			fillSpace = nextComponentOffset - structLen;
		}
	}
Insert minimal padding into structure prior to the addition of a component such that packing
will allow component to be placed at intended offset.
@param nextComponentOffset
@param dt
Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/DefaultCompositeMember.java