refactor/cksum ~ polish spelling (comments, names, and exceptions)

This commit is contained in:
Roy Ivy III 2021-05-30 00:01:36 -05:00
parent 43f5c13a7f
commit fc5451b5e7

View file

@ -99,15 +99,15 @@ const fn crc_entry(input: u8) -> u32 {
// i += 1;
//}
unroll!(8, |_i| {
let if_cond = crc & 0x8000_0000;
let if_condition = crc & 0x8000_0000;
let if_body = (crc << 1) ^ 0x04c1_1db7;
let else_body = crc << 1;
// NOTE: i feel like this is easier to understand than emulating an if statement in bitwise
// ops
let cond_table = [else_body, if_body];
let condition_table = [else_body, if_body];
crc = cond_table[(if_cond != 0) as usize];
crc = condition_table[(if_condition != 0) as usize];
});
crc