From 6df224bdbacd2a9a009411cf75ff50e0348284df Mon Sep 17 00:00:00 2001 From: kirbylife Date: Fri, 20 May 2022 00:32:43 -0500 Subject: [PATCH] Remove useless data --- Cargo.toml | 2 -- src/lib.rs | 16 +++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 171882a..4673a5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,4 @@ name = "inflate_nostd" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 39983a8..f5c8b35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,10 @@ +#![no_std] + +extern crate alloc; + +use alloc::boxed::Box; +use alloc::vec::Vec; + trait ParallelReverse { 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 CLENSBUFFER: [u8; 19] = [0; 19]; #[derive(Debug)] struct CodeLengthReader { @@ -73,10 +79,6 @@ impl CodeLengthReader { PATTERNSBUFFER.fill(0xffu8); }; 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(); for rest in 0u8 .. 1u8 << (7 - bits) { unsafe {PATTERNSBUFFER[(base | (rest << bits)) as usize] = i}; @@ -787,7 +789,3 @@ fn inflate(inflater: &mut InflateStream, data: &[u8]) -> Result, &'stati pub fn inflate_bytes(data: &[u8]) -> Result, &'static str> { inflate(&mut InflateStream::new(), data) } - -pub fn test() { - println!("hola mundo"); -}