pub enum LogosInt {
Small(i64),
Big(Box<BigInt>),
}Expand description
The exact integer for GENERATED code: i64 on the fast path, spilling to a
heap [logicaffeine_base::BigInt] the moment a value escapes 64 bits — the
AOT’s mirror of the interpreter’s Int→BigInt promotion (and of the JIT’s
overflow side-exit). Every operation NORMALIZES: a big result that fits
i64 downsizes to Small, so representation never leaks into ==/Ord.
Variants§
Implementations§
Source§impl LogosInt
impl LogosInt
pub fn from_i64(x: i64) -> Self
pub fn from_big(b: BigInt) -> Self
Sourcepub fn from_literal(s: &str) -> Self
pub fn from_literal(s: &str) -> Self
Parse a (possibly > 64-bit) decimal literal the codegen emitted.
Sourcepub fn expect_i64(&self, what: &str) -> i64
pub fn expect_i64(&self, what: &str) -> i64
The value as i64, or a LOUD canonical error — for sinks that are
structurally 64-bit (indices, sizes, native call arguments).
pub fn add(&self, rhs: &LogosInt) -> LogosInt
pub fn sub(&self, rhs: &LogosInt) -> LogosInt
pub fn mul(&self, rhs: &LogosInt) -> LogosInt
Sourcepub fn div(&self, rhs: &LogosInt) -> Result<LogosInt, String>
pub fn div(&self, rhs: &LogosInt) -> Result<LogosInt, String>
Truncating division; Err on a zero divisor (the interp’s catchable
“Division by zero”). i64::MIN / -1 promotes exactly.
Sourcepub fn div_floor(&self, rhs: &LogosInt) -> Result<LogosInt, String>
pub fn div_floor(&self, rhs: &LogosInt) -> Result<LogosInt, String>
Floor division — the quotient rounded toward NEGATIVE INFINITY (-7 // 2 → -4),
the semantics of the // operator. Distinct from div, which
truncates toward zero (-7 / 2 → -3); the two agree when the operands share a
sign. Exact (promotes to BigInt); a zero divisor is a loud error.
Sourcepub fn rem(&self, rhs: &LogosInt) -> Result<LogosInt, String>
pub fn rem(&self, rhs: &LogosInt) -> Result<LogosInt, String>
Truncating remainder (sign of the dividend); i64::MIN % -1 is 0.
Sourcepub fn pow(&self, exp: &LogosInt) -> Result<LogosInt, String>
pub fn pow(&self, exp: &LogosInt) -> Result<LogosInt, String>
Exponentiation with an integer exponent. Err on a negative exponent
(an Int can’t hold the fractional result) or one too large to be a
u32 power; overflow of the i64 fast path promotes to BigInt
exactly. Mirrors the interpreter’s int_power.
pub fn neg(&self) -> LogosInt
Trait Implementations§
Source§impl Ord for LogosInt
impl Ord for LogosInt
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd<LogosInt> for i64
impl PartialOrd<LogosInt> for i64
Source§impl PartialOrd<i64> for LogosInt
impl PartialOrd<i64> for LogosInt
Source§impl PartialOrd for LogosInt
impl PartialOrd for LogosInt
impl Eq for LogosInt
Auto Trait Implementations§
impl Freeze for LogosInt
impl RefUnwindSafe for LogosInt
impl Send for LogosInt
impl Sync for LogosInt
impl Unpin for LogosInt
impl UnsafeUnpin for LogosInt
impl UnwindSafe for LogosInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.