MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / range_int

Function range_int

compiler/src/modules/vm/builtins/sequence.rs:10–13  ·  view source on GitHub ↗

A range element as a Val, promoting magnitudes beyond the 47-bit inline range to LongInt. */

(heap: &mut HeapPool, i: i64)

Source from the content-addressed store, hash-verified

8
9/* A range element as a Val, promoting magnitudes beyond the 47-bit inline range to LongInt. */
10pub(crate) fn range_int(heap: &mut HeapPool, i: i64) -> Result<Val, VmErr> {
11 if (Val::INT_MIN..=Val::INT_MAX).contains(&i) { Ok(Val::int(i)) }
12 else { heap.alloc(HeapObj::LongInt(i as i128)) }
13}
14
15// Lazy walker for short-circuit builtins; Vec variant copies because list/set/dict can't stream without a mutable heap borrow.
16pub(crate) enum IterCursor {

Callers 4

next_itemMethod · 0.85
nextMethod · 0.85
extract_iterMethod · 0.85

Calls 2

containsMethod · 0.45
allocMethod · 0.45

Tested by

no test coverage detected