public AssemblyPatternBlock trim() {

		var minNonZeroMask = Integer.MAX_VALUE;
		var maxNonZeroMask = -1;
		for (int i = 0; i < this.mask.length; i++) {
			if (mask[i] != 0) {
				minNonZeroMask = Math.min(minNonZeroMask, i);
				maxNonZeroMask = i;
			}
		}
		if (maxNonZeroMask == -1) {
			return AssemblyPatternBlock.nop();
		}

		var bitShiftAmount = Integer.numberOfTrailingZeros(mask[maxNonZeroMask]);

		var newMask = bitShiftRightByteArray(
			Arrays.copyOfRange(mask, minNonZeroMask, maxNonZeroMask + 1), bitShiftAmount);
		var newVals = bitShiftRightByteArray(
			Arrays.copyOfRange(vals, minNonZeroMask, maxNonZeroMask + 1), bitShiftAmount);

		if (newMask[0] == 0) {
			newMask = Arrays.copyOfRange(newMask, 1, newMask.length);
			newVals = Arrays.copyOfRange(newVals, 1, newVals.length);
		}
		return new AssemblyPatternBlock(0, newMask, newVals);
	}
Remove all unknown bits from both left and right

@return new value without any left or right unknown bits (but may have unknown bits in the
        middle)
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyPatternBlock.java