Helper method to combine an opcode and a second byte of data into the appropriate form for emitting into a code buffer. @param insn non-null; the instruction containing the opcode @param arg 0..255; arbitrary other byte value @return combined value
(DalvInsn insn, int arg)
| 436 | * @return combined value |
| 437 | */ |
| 438 | protected static short opcodeUnit(DalvInsn insn, int arg) { |
| 439 | if ((arg & 0xff) != arg) { |
| 440 | throw new IllegalArgumentException("arg out of range 0..255"); |
| 441 | } |
| 442 | |
| 443 | int opcode = insn.getOpcode().getOpcode(); |
| 444 | |
| 445 | if ((opcode & 0xff) != opcode) { |
| 446 | throw new IllegalArgumentException("opcode out of range 0..255"); |
| 447 | } |
| 448 | |
| 449 | return (short) (opcode | (arg << 8)); |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Helper method to get an extended (16-bit) opcode out of an |
no test coverage detected