public static Term execute(Process proc, Module m, Instruction i, List params) { Integer source1 = i.arg(1).toArg(proc).toInteger(); Integer source2 = i.arg(2).toArg(proc).toInteger(); Integer unit = i.arg(3).toArg(proc).toInteger(); Integer result = source1.add(source2.multiply(unit)); Term destination = i.arg(4); if (destination.isXRegister()) { proc.setX(destination.toRegisterIndex(), result); return null; } else { throw new Error("Not implemented: " + i); } }
/** http://www.erlang.org/doc/man/erlang.html#process_flag-2 */ public static Term process_flag_2(Atom flag, Term value) { return Boolean.of(ProcessFlag.process_flag(flag, value.isTrue())); }