Remove useless data

main
kirbylife 2022-05-20 00:32:43 -05:00
parent c1f27e3d9e
commit 6df224bdba
2 changed files with 7 additions and 11 deletions

View File

@ -3,6 +3,4 @@ name = "inflate_nostd"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]

View File

@ -1,3 +1,10 @@
#![no_std]
extern crate alloc;
use alloc::boxed::Box;
use alloc::vec::Vec;
trait ParallelReverse { trait ParallelReverse {
fn swap_bits(self) -> Self; fn swap_bits(self) -> Self;
} }
@ -52,7 +59,6 @@ macro_rules! with_codes (($clens:expr, $max_bits:expr => $code_ty:ty, $cb:expr)
})); }));
static mut PATTERNSBUFFER: [u8; 128] = [0xffu8; 128]; static mut PATTERNSBUFFER: [u8; 128] = [0xffu8; 128];
static mut CLENSBUFFER: [u8; 19] = [0; 19];
#[derive(Debug)] #[derive(Debug)]
struct CodeLengthReader { struct CodeLengthReader {
@ -73,10 +79,6 @@ impl CodeLengthReader {
PATTERNSBUFFER.fill(0xffu8); PATTERNSBUFFER.fill(0xffu8);
}; };
with_codes!(clens, 7 => u8, |i: u8, code: u8, bits| -> _ { with_codes!(clens, 7 => u8, |i: u8, code: u8, bits| -> _ {
/*let base = match BIT_REV_U8.get((code << (8 - bits)) as usize) {
Some(&base) => base,
None => return Err("invalid length code".to_owned())
}*/
let base = (code << (8 - bits as u8)).swap_bits(); let base = (code << (8 - bits as u8)).swap_bits();
for rest in 0u8 .. 1u8 << (7 - bits) { for rest in 0u8 .. 1u8 << (7 - bits) {
unsafe {PATTERNSBUFFER[(base | (rest << bits)) as usize] = i}; unsafe {PATTERNSBUFFER[(base | (rest << bits)) as usize] = i};
@ -787,7 +789,3 @@ fn inflate(inflater: &mut InflateStream, data: &[u8]) -> Result<Vec<u8>, &'stati
pub fn inflate_bytes(data: &[u8]) -> Result<Vec<u8>, &'static str> { pub fn inflate_bytes(data: &[u8]) -> Result<Vec<u8>, &'static str> {
inflate(&mut InflateStream::new(), data) inflate(&mut InflateStream::new(), data)
} }
pub fn test() {
println!("hola mundo");
}