Remove useless data
parent
c1f27e3d9e
commit
6df224bdba
|
@ -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]
|
||||
|
|
16
src/lib.rs
16
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<Vec<u8>, &'stati
|
|||
pub fn inflate_bytes(data: &[u8]) -> Result<Vec<u8>, &'static str> {
|
||||
inflate(&mut InflateStream::new(), data)
|
||||
}
|
||||
|
||||
pub fn test() {
|
||||
println!("hola mundo");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue