stage: moving performance enhancements into main

several incomplete features are gated behind the `experimental_features` flag.
This commit is contained in:
Henry Schimke
2024-02-07 13:22:07 -06:00
parent c554a469cd
commit 76e8998f4b
33 changed files with 684 additions and 548 deletions

View File

@@ -18,6 +18,8 @@
// import java.io.ByteArrayOutputStream;
use std::io::Write;
/**
* Class that lets one easily build an array of bytes by appending bits at a time.
*
@@ -71,3 +73,19 @@ impl Default for BitSourceBuilder {
Self::new()
}
}
impl Write for BitSourceBuilder {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
let mut written = 0;
for byte in buf.iter() {
self.write(*byte as u32, 8);
written += 1;
}
Ok(written)
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}