Skip to content

Commit

Permalink
compression: Use the sl-std ringbuffer implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Mar 16, 2024
1 parent bc110a6 commit a771372
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 83 deletions.
7 changes: 4 additions & 3 deletions crates/compression/src/brotli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ pub mod dictionary;
use crate::{
bitreader::{self, BitReader},
huffman::{Bits, HuffmanBitTree, HuffmanTree},
ringbuffer::RingBuffer,
};

use sl_std::ring_buffer::RingBuffer;

use std::cmp::min;

macro_rules! update_block_type_and_count {
Expand Down Expand Up @@ -149,7 +150,7 @@ pub fn decompress(source: &[u8]) -> Result<Vec<u8>, Error> {
};

let window_size = (1 << wbits) - 16;
let mut past_distances = RingBuffer::new([16, 15, 11, 4]);
let mut past_distances = RingBuffer::from([16, 15, 11, 4]);

let mut is_last = false;
while !is_last {
Expand Down Expand Up @@ -364,7 +365,7 @@ pub fn decompress(source: &[u8]) -> Result<Vec<u8>, Error> {

// Dictionary references, 0 distances and a few transformations are not pushed
if distance_code != 0 && distance < max_distance + 1 {
past_distances.push(distance);
past_distances.push_overwriting(distance);
}
distance
};
Expand Down
1 change: 0 additions & 1 deletion crates/compression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ pub mod zlib;
pub mod bitreader;
pub mod gzip;
pub mod huffman;
pub mod ringbuffer;
79 changes: 0 additions & 79 deletions crates/compression/src/ringbuffer.rs

This file was deleted.

0 comments on commit a771372

Please sign in to comment.