oxide_core/heap/bigint.rs
1//! BigInt records. Every BigInt is a heap record: an `i64` does not fit the
2//! 32-bit payload. This module defines the record and its tracing; the
3//! arithmetic is `vm::bigint`'s.
4
5use super::arena::Record;
6
7#[derive(Clone, Debug, PartialEq, Eq)]
8pub struct BigIntRecord {
9 pub negative: bool,
10 /// Magnitude, least significant limb first, no trailing zero limbs.
11 pub limbs: Box<[u64]>,
12}
13
14impl Record for BigIntRecord {
15 fn vacant() -> Self {
16 BigIntRecord {
17 negative: false,
18 limbs: Box::new([]),
19 }
20 }
21
22 fn extra_bytes(&self) -> usize {
23 self.limbs.len() * 8
24 }
25}