protected static int checkRead(byte[] arr, int idx, int def) {
		// When there's an offset, idx can be < 0
		if (idx >= arr.length || idx < 0) {
			return 0xff & def;
		}
		return 0xff & arr[idx];
	}
Read an array, returning a default if the index is out of bounds

@param arr the array to read
@param idx the index
@param def the default value
@return the read value
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyPatternBlock.java