Implementation of the UM-32 "Universal Machine" as described by the Cult of the Bound Variable

make `smallvec` non-optional

tjh 28045747 3377a70d

+2 -14
+2 -3
Cargo.toml
··· 4 edition = "2021" 5 6 [dependencies] 7 - smallvec = { version = "1.13.2", optional = true } 8 9 [features] 10 - default = ["reclaim-memory", "smallvec"] 11 reclaim-memory = [] 12 - smallvec = ["dep:smallvec"] 13 timing = []
··· 4 edition = "2021" 5 6 [dependencies] 7 + smallvec = { version = "1.13.2" } 8 9 [features] 10 + default = ["reclaim-memory"] 11 reclaim-memory = [] 12 timing = []
-11
src/main.rs
··· 1 - #[cfg(feature = "smallvec")] 2 use smallvec::SmallVec; 3 use std::io::{Read, Write}; 4 #[cfg(feature = "timing")] 5 use std::time::Instant; 6 use um::{Operation, Parameter, Platter}; 7 8 - #[cfg(feature = "smallvec")] 9 const SMALLVEC_SIZE: usize = 24; 10 11 fn main() { ··· 51 pub struct Um<'a> { 52 program_counter: Platter, 53 registers: [Platter; 8], 54 - #[cfg(feature = "smallvec")] 55 memory: Vec<SmallVec<[Platter; SMALLVEC_SIZE]>>, 56 - #[cfg(not(feature = "smallvec"))] 57 - memory: Vec<Vec<Platter>>, 58 #[cfg(feature = "reclaim-memory")] 59 free_blocks: Vec<Platter>, 60 ops: Vec<Operation>, ··· 366 ) 367 } 368 369 - #[cfg(feature = "smallvec")] 370 fn new_block(len: usize) -> SmallVec<[Platter; SMALLVEC_SIZE]> { 371 smallvec::smallvec![0; len] 372 - } 373 - 374 - #[cfg(not(feature = "smallvec"))] 375 - fn new_block(len: usize) -> Vec<Platter> { 376 - vec![0; len] 377 } 378 }
··· 1 use smallvec::SmallVec; 2 use std::io::{Read, Write}; 3 #[cfg(feature = "timing")] 4 use std::time::Instant; 5 use um::{Operation, Parameter, Platter}; 6 7 const SMALLVEC_SIZE: usize = 24; 8 9 fn main() { ··· 49 pub struct Um<'a> { 50 program_counter: Platter, 51 registers: [Platter; 8], 52 memory: Vec<SmallVec<[Platter; SMALLVEC_SIZE]>>, 53 #[cfg(feature = "reclaim-memory")] 54 free_blocks: Vec<Platter>, 55 ops: Vec<Operation>, ··· 361 ) 362 } 363 364 fn new_block(len: usize) -> SmallVec<[Platter; SMALLVEC_SIZE]> { 365 smallvec::smallvec![0; len] 366 } 367 }