public void decode(Decoder decoder) throws DecoderException {
		int el = decoder.openElement(ELEM_PAT_BLOCK);
		offset = (int) decoder.readSignedInteger(ATTRIB_OFF);
		nonzerosize = (int) decoder.readSignedInteger(ATTRIB_NONZERO);
		ArrayList<Integer> masks = new ArrayList<>();
		ArrayList<Integer> vals = new ArrayList<>();
		while (decoder.peekElement() == ELEM_MASK_WORD.id()) {
			decoder.openElement();
			masks.add((int) decoder.readUnsignedInteger(ATTRIB_MASK));
			vals.add((int) decoder.readUnsignedInteger(ATTRIB_VAL));
			decoder.closeElement(ELEM_MASK_WORD.id());
		}
		maskvec = new int[masks.size()];
		valvec = new int[vals.size()];
		for (int i = 0; i < maskvec.length; ++i) {
			maskvec[i] = masks.get(i);
			valvec[i] = vals.get(i);
		}
		decoder.closeElement(el);
	}
A mask/value pair viewed as two bitstreams
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/pattern/PatternBlock.java