(&mut self, r: Option<i128>)
| 579 | /* Wrap an i128 into the narrowest Val: None->Overflow, 47-bit->inline, else LongInt. */ |
| 580 | #[inline] |
| 581 | pub(crate) fn int_to_val(&mut self, r: Option<i128>) -> Result<Val, VmErr> { |
| 582 | let i = r.ok_or(cold_overflow())?; |
| 583 | if (Val::INT_MIN as i128..=Val::INT_MAX as i128).contains(&i) { |
| 584 | return Ok(Val::int(i as i64)); |
| 585 | } |
| 586 | self.heap.alloc(HeapObj::LongInt(i)) |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | /* i128 decimal render via itoa to avoid the heavier `format!` machinery on the hot path. */ |
no test coverage detected