Skip to content

Commit 052601b

Browse files
committed
fixed index out of bounds: the len is 266 but the index is 266
1 parent f0f99d4 commit 052601b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn calculate_entropy(data: &[u8]) -> f64 {
4444
for &count in byte_counts.iter().filter(|&&c| c > 0) {
4545
let probability = count as f64 / len;
4646

47-
if count < 267 {
47+
if count < 266 {
4848
entropy -= probability * LOG2_TABLE[count as usize];
4949
} else {
5050
entropy -= probability * (probability.ln() / std::f64::consts::LN_2);

0 commit comments

Comments
 (0)