diff --git a/src/crc128.rs b/src/crc128.rs index d346e97..11c77e2 100644 --- a/src/crc128.rs +++ b/src/crc128.rs @@ -77,7 +77,7 @@ const fn update_slice16( let mut i = 0; let len = bytes.len(); if reflect { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ crc as u8; let current1 = bytes[i + 1] ^ (crc >> 8) as u8; let current2 = bytes[i + 2] ^ (crc >> 16) as u8; @@ -121,7 +121,7 @@ const fn update_slice16( i += 1; } } else { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ (crc >> 120) as u8; let current1 = bytes[i + 1] ^ (crc >> 112) as u8; let current2 = bytes[i + 2] ^ (crc >> 104) as u8; diff --git a/src/crc16.rs b/src/crc16.rs index b82d949..bb31de8 100644 --- a/src/crc16.rs +++ b/src/crc16.rs @@ -76,7 +76,7 @@ const fn update_slice16( let len = bytes.len(); let mut i = 0; if reflect { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ (crc as u8); let current1 = bytes[i + 1] ^ ((crc >> 8) as u8); @@ -106,7 +106,7 @@ const fn update_slice16( i += 1; } } else { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ ((crc >> 8) as u8); let current1 = bytes[i + 1] ^ (crc as u8); diff --git a/src/crc64.rs b/src/crc64.rs index 3fc3233..b2ff118 100644 --- a/src/crc64.rs +++ b/src/crc64.rs @@ -78,7 +78,7 @@ const fn update_slice16( let mut i = 0; let len = bytes.len(); if reflect { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ crc as u8; let current1 = bytes[i + 1] ^ (crc >> 8) as u8; let current2 = bytes[i + 2] ^ (crc >> 16) as u8; @@ -114,7 +114,7 @@ const fn update_slice16( i += 1; } } else { - while i + 16 < len { + while i + 16 <= len { let current0 = bytes[i] ^ (crc >> 56) as u8; let current1 = bytes[i + 1] ^ (crc >> 48) as u8; let current2 = bytes[i + 2] ^ (crc >> 40) as u8; diff --git a/src/crc8.rs b/src/crc8.rs index d075100..9587e2a 100644 --- a/src/crc8.rs +++ b/src/crc8.rs @@ -57,7 +57,7 @@ const fn update_slice16(mut crc: u8, table: &[[u8; 256]; 16], bytes: &[u8]) -> u let len = bytes.len(); let mut i = 0; - while i + 16 < len { + while i + 16 <= len { crc = table[0][bytes[i + 15] as usize] ^ table[1][bytes[i + 14] as usize] ^ table[2][bytes[i + 13] as usize]