Refactor the memory slot check logic to improve readability Bug: 293811969 Test: TH Change-Id: I77e91960e46aeb2c205d772e0f3e6129b97dd5b4
diff --git a/src/android/net/apf/ApfGenerator.java b/src/android/net/apf/ApfGenerator.java index 28234b1..12b09a8 100644 --- a/src/android/net/apf/ApfGenerator.java +++ b/src/android/net/apf/ApfGenerator.java
@@ -285,7 +285,7 @@ Instruction(ExtendedOpcodes extendedOpcodes, int slot, Register register) throws IllegalInstructionException { this(Opcodes.EXT, register); - if (slot < 0 || slot > (MEMORY_SLOTS - 1)) { + if (slot < 0 || slot >= MEMORY_SLOTS) { throw new IllegalInstructionException("illegal memory slot number: " + slot); } addUnsignedIndeterminate(extendedOpcodes.value + slot);