mod hash;
mod pattern;
mod state;
mod writer;
pub use state::ImplodeState;
pub use writer::ImplodeWriter;
use crate::Result;
use std::io::Write;
pub const WORK_BUFF_SIZE: usize = 0x2204;
pub const OUT_BUFF_SIZE: usize = 0x802;
pub const HASH_TABLE_SIZE: usize = 0x900;
pub const OFFSS_SIZE2: usize = 0x204;
pub const LITERALS_COUNT: usize = 0x306;
pub const fn byte_pair_hash(buffer: &[u8]) -> usize {
((buffer[0] as usize) * 4) + ((buffer[1] as usize) * 5)
}
pub const MAX_REP_LENGTH: usize = 0x204;
pub fn implode_bytes(
data: &[u8],
mode: crate::CompressionMode,
dict_size: crate::DictionarySize,
) -> Result<Vec<u8>> {
let mut output = Vec::new();
{
let mut writer = ImplodeWriter::new(&mut output, mode, dict_size)?;
writer.write_all(data)?;
writer.finish()?;
}
Ok(output)
}