about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDevon Sawatsky <novedevo@gmail.com>2023-10-22 17:13:44 -0700
committerDevon Sawatsky <novedevo@gmail.com>2023-10-22 17:13:44 -0700
commit22a1bdf44a1f18d91d3dd286eb349e75d762c0f6 (patch)
treef1e328bb9f6c9c3f30aa0ce9d2fd2733ffefb6ac
parent4a6344de4f81fb15c2c33e856ef2a02c40908cd9 (diff)
downloadgifed-22a1bdf44a1f18d91d3dd286eb349e75d762c0f6.tar.gz
gifed-22a1bdf44a1f18d91d3dd286eb349e75d762c0f6.zip
add better lzw variable names
-rw-r--r--gifed/src/lzw.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/gifed/src/lzw.rs b/gifed/src/lzw.rs
index bbf1d8c..53451da 100644
--- a/gifed/src/lzw.rs
+++ b/gifed/src/lzw.rs
@@ -5,24 +5,24 @@ impl LZW {
 	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;
+		let clear_code = 1 << minimum_size;
+		let end_of_information_code = clear_code + 1;
 
-		println!("mcs {minimum_size} | cc {cc}");
+		println!("mcs {minimum_size} | cc {clear_code}");
 
 		// Fill dictionary with self-descriptive values
-		for value in 0..cc {
+		for value in 0..clear_code {
 			dictionary.insert(vec![value as u8], value);
 		}
 
-		let mut next_code = eoi + 1;
+		let mut next_code = end_of_information_code + 1;
 		let mut code_size = minimum_size + 1;
 
 		let mut iter = indices.iter();
 		let mut out = BitStream::new();
 		let mut buffer = vec![*iter.next().unwrap()];
 
-		out.push_bits(code_size, cc);
+		out.push_bits(code_size, clear_code);
 
 		for &index in iter {
 			buffer.push(index);