public static AssemblyPatternBlock fromTokenField(TokenField tf, MaskedLong val) {
		int size = tf.getByteEnd() - tf.getByteStart() + 1;

		val = val.mask(tf.maxValue());
		try {
			val = val.invShiftRightLogical(tf.getShift());
		}
		catch (SolverException e) {
			throw new AssertionError(e);
		}
		if (!tf.isBigEndian()) {
			val = val.byteSwap(size);
		}

		byte[] mask = new byte[size];
		byte[] vals = new byte[size];
		long lmsk = val.getMask();
		long lval = val.longValue();
		for (int i = size - 1; i >= 0; i--) {
			mask[i] = (byte) (lmsk & 0xff);
			vals[i] = (byte) (lval & 0xff);
			lmsk >>= 8;
			lval >>= 8;
		}
		return new AssemblyPatternBlock(tf.getByteStart(), mask, vals);
	}
Encode the given masked long into a pattern block as specified by a given token field

@param tf the token field specifying the location of the value to encode
@param val the value to encode
@return the pattern block with the encoded value
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyPatternBlock.java