Implemented num_order methods on Integer & Rational numbers

This commit is contained in:
Fayeed Pawaskar
2023-09-04 14:12:47 +05:30
parent cfd67c8337
commit 7b921fc767
10 changed files with 240 additions and 131 deletions

View File

@@ -258,7 +258,10 @@ pub(crate) fn to_local_code_ptr(heap: &Heap, addr: HeapCellValue) -> Option<usiz
let extract_integer = |s: usize| -> Option<usize> {
match Number::try_from(heap[s]) {
Ok(Number::Fixnum(n)) => usize::try_from(n.get_num()).ok(),
Ok(Number::Integer(n)) => n.to_usize(),
Ok(Number::Integer(n)) => {
let value: usize = n.value().try_into().unwrap();
Some(value)
},
_ => None,
}
};