(self, type: RType, lhs: Value, rhs: Value, line: int)
| 2605 | self.activate_block(ok) |
| 2606 | |
| 2607 | def inline_fixed_width_divide(self, type: RType, lhs: Value, rhs: Value, line: int) -> Value: |
| 2608 | # Perform floor division (native division truncates) |
| 2609 | res = Register(type) |
| 2610 | div = self.int_op(type, lhs, rhs, IntOp.DIV, line) |
| 2611 | self.add(Assign(res, div)) |
| 2612 | same_signs = self.is_same_native_int_signs(type, lhs, rhs, line) |
| 2613 | tricky, adjust, done = BasicBlock(), BasicBlock(), BasicBlock() |
| 2614 | self.add(Branch(same_signs, done, tricky, Branch.BOOL)) |
| 2615 | self.activate_block(tricky) |
| 2616 | mul = self.int_op(type, res, rhs, IntOp.MUL, line) |
| 2617 | mul_eq = self.add(ComparisonOp(mul, lhs, ComparisonOp.EQ, line)) |
| 2618 | self.add(Branch(mul_eq, done, adjust, Branch.BOOL)) |
| 2619 | self.activate_block(adjust) |
| 2620 | adj = self.int_op(type, res, Integer(1, type), IntOp.SUB, line) |
| 2621 | self.add(Assign(res, adj)) |
| 2622 | self.add(Goto(done)) |
| 2623 | self.activate_block(done) |
| 2624 | return res |
| 2625 | |
| 2626 | def inline_fixed_width_mod(self, type: RType, lhs: Value, rhs: Value, line: int) -> Value: |
| 2627 | # Perform floor modulus |
no test coverage detected