Skip to content

Commit b3843be

Browse files
committed
zdict.rs: make doneMarks use bool
1 parent 92c040c commit b3843be

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/dictBuilder/zdict.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ unsafe fn ZDICT_count(
149149
const LLIMIT: usize = 64;
150150
const MINMATCHLENGTH: usize = 7;
151151
unsafe fn ZDICT_analyzePos(
152-
doneMarks: &mut [u8],
152+
doneMarks: &mut [bool],
153153
suffix_slice: &[u32],
154154
mut start: u32,
155155
buffer: *const core::ffi::c_void,
@@ -175,7 +175,7 @@ unsafe fn ZDICT_analyzePos(
175175
let mut end = start;
176176
let mut solution = DictItem::default();
177177

178-
doneMarks[pos] = 1;
178+
doneMarks[pos] = true;
179179

180180
// trivial repetition cases
181181
if MEM_read16(b.add(pos) as *const core::ffi::c_void) as core::ffi::c_int
@@ -202,7 +202,7 @@ unsafe fn ZDICT_analyzePos(
202202
}
203203
u = 1;
204204
while u < patternEnd {
205-
doneMarks[pos.wrapping_add(u as size_t)] = 1;
205+
doneMarks[pos.wrapping_add(u as size_t)] = true;
206206
u = u.wrapping_add(1);
207207
}
208208
return solution;
@@ -241,7 +241,7 @@ unsafe fn ZDICT_analyzePos(
241241
let mut idx: u32 = 0;
242242
idx = start;
243243
while idx < end {
244-
doneMarks[suffix(idx as usize) as usize] = 1;
244+
doneMarks[suffix(idx as usize) as usize] = true;
245245
idx = idx.wrapping_add(1);
246246
}
247247
return solution;
@@ -431,7 +431,7 @@ unsafe fn ZDICT_analyzePos(
431431
pEnd = testedPos.wrapping_add(length_3);
432432
p = testedPos;
433433
while p < pEnd {
434-
doneMarks[p as usize] = 1;
434+
doneMarks[p as usize] = true;
435435
p = p.wrapping_add(1);
436436
}
437437
id_0 = id_0.wrapping_add(1);
@@ -687,10 +687,10 @@ unsafe fn ZDICT_trainBuffer_legacy(
687687
eprintln!("minimum ratio : {} ", minRatio);
688688
}
689689

690-
let mut doneMarks = vec![0u8; bufferSize + 16];
690+
let mut doneMarks = vec![false; bufferSize + 16];
691691
let mut cursor = 0usize;
692692
while cursor < bufferSize {
693-
if doneMarks[cursor] != 0 {
693+
if doneMarks[cursor] {
694694
cursor += 1;
695695
continue;
696696
}

test-libzstd-rs-sys/src/dict_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn test_train_from_buffer_fastcover() {
196196

197197
#[test]
198198
#[cfg(not(target_family = "wasm"))]
199-
#[cfg_attr(miri, ignore = "slow")]
199+
// #[cfg_attr(miri, ignore = "slow")]
200200
fn test_train_from_buffer_legacy() {
201201
let input_data = "The quick brown fox jumps high";
202202

0 commit comments

Comments
 (0)