make indexer downcast Integers to Fixnums when possible, be slightly more judicious about allocating Integers instead of Fixnums (#2340)

This commit is contained in:
Mark
2024-02-29 16:15:28 -07:00
parent f2d3779fa9
commit 42f4827854
3 changed files with 17 additions and 17 deletions

View File

@@ -269,7 +269,16 @@ impl MachineState {
Literal::Rational(r)
}
(ArenaHeaderTag::Integer, n) => {
Literal::Integer(n)
let result = (&*n).try_into();
match result {
Ok(fixnum) => if let Ok(n) = Fixnum::build_with_checked(fixnum) {
Literal::Fixnum(n)
} else {
Literal::Integer(n)
},
Err(_) => Literal::Integer(n)
}
}
_ => {
unreachable!()