Skip to content

Commit a37486b

Browse files
committed
position_array: Check and use character occupation
While it checked whether each positions are occupied by multiple characters, it was not reflected in the return value. This commit fixes this simple issue (along with a typo).
1 parent bc03d01 commit a37486b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ffuzzy/src/compare/position_array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,18 @@ pub trait BlockHashPositionArrayData {
173173
}
174174
let expected_total: u64 = u64_lsb_ones(len as u32);
175175
let mut total: u64 = 0;
176-
self.representation().iter().all(
176+
let has_no_multi_occupation = self.representation().iter().all(
177177
#[inline(always)]
178178
|&pos| {
179-
// Invalid if multiple alphabets are occupy the same position.
179+
// Invalid if multiple alphabets occupy the same position.
180180
let is_valid = (total & pos) == 0;
181181
total |= pos;
182182
is_valid
183183
},
184184
);
185185
// All characters in the string must be placed in the position array
186186
// and no characters may be placed outside the string.
187-
total == expected_total
187+
has_no_multi_occupation && total == expected_total
188188
}
189189

190190
/// Performs full validity checking and the normalization test

0 commit comments

Comments
 (0)