(&mut self, a: Val, b: Val)
| 330 | } |
| 331 | |
| 332 | fn exec_shr(&mut self, a: Val, b: Val) -> Result<Val, VmErr> { |
| 333 | if !b.is_int() { return Err(cold_type("shift count must be an integer")); } |
| 334 | let shift = b.as_int(); |
| 335 | if shift < 0 { return Err(cold_value("negative shift count")); } |
| 336 | let ai = self.as_i128(a).ok_or(cold_type(">> requires an integer"))?; |
| 337 | // i128 >> is arithmetic (floor on negatives); `.min(127)` dodges shift-count UB. |
| 338 | self.int_to_val(Some(ai >> shift.min(127))) |
| 339 | } |
| 340 | |
| 341 | pub(crate) fn handle_compare(&mut self, op: OpCode, rip: usize, cache: &mut OpcodeCache, chunk: &SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> { |
| 342 | let (a, b) = self.pop2()?; |
no test coverage detected