diff options
author | Devon Sawatsky <novedevo@gmail.com> | 2023-10-21 23:39:09 -0700 |
---|---|---|
committer | Devon Sawatsky <novedevo@gmail.com> | 2023-10-21 23:39:09 -0700 |
commit | 1097d7d5e930cbdecb3a8360b0083407a79ad2da (patch) | |
tree | e391544c97330514400b41b7ef6e2af815bdef75 | |
parent | ea2a68e2772b6e1a562db644bc665787e5011267 (diff) | |
download | gifed-1097d7d5e930cbdecb3a8360b0083407a79ad2da.tar.gz gifed-1097d7d5e930cbdecb3a8360b0083407a79ad2da.zip |
fix spelling & minor changes
-rw-r--r-- | gifed/src/lzw.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gifed/src/lzw.rs b/gifed/src/lzw.rs index cd3fcd5..f787fdd 100644 --- a/gifed/src/lzw.rs +++ b/gifed/src/lzw.rs @@ -2,13 +2,13 @@ use std::collections::HashMap; pub struct LZW {} impl LZW { - pub fn encode(minimum_size: u8, indicies: &[u8]) -> Vec<u8> { + pub fn encode(minimum_size: u8, indices: &[u8]) -> Vec<u8> { let mut dictionary: HashMap<Vec<u8>, u16> = HashMap::new(); let cc = 1 << minimum_size; let eoi = cc + 1; - println!("mcs {} | cc {}", minimum_size, cc); + println!("mcs {minimum_size} | cc {cc}"); // Fill dictionary with self-descriptive values for value in 0..cc { @@ -18,14 +18,14 @@ impl LZW { let mut next_code = eoi + 1; let mut code_size = minimum_size + 1; - let mut iter = indicies.iter(); + let mut iter = indices.iter(); let mut out = BitStream::new(); let mut buffer = vec![*iter.next().unwrap()]; out.push_bits(code_size, cc); - for &indicie in iter { - buffer.push(indicie); + for &index in iter { + buffer.push(index); if !dictionary.contains_key(&buffer) { buffer.pop(); |