diff --git a/libsais64-rs/src/lib.rs b/libsais64-rs/src/lib.rs index 8b075bd..e0ff871 100644 --- a/libsais64-rs/src/lib.rs +++ b/libsais64-rs/src/lib.rs @@ -37,7 +37,7 @@ pub fn sais64(text: &Vec, sparseness_factor: u8) -> Result, &str> { libsais_sparseness -= 1; } - if sparseness_factor % libsais_sparseness != 0 { + if libsais_sparseness * BITS_PER_CHAR <= 16 { return Err("invalid sparseness factor"); } diff --git a/sa-builder/src/lib.rs b/sa-builder/src/lib.rs index 529e1be..2cd4afb 100644 --- a/sa-builder/src/lib.rs +++ b/sa-builder/src/lib.rs @@ -56,8 +56,7 @@ pub fn build_ssa( let mut sa = match construction_algorithm { SAConstructionAlgorithm::LibSais => libsais64_rs::sais64(&text, sparseness_factor)?, SAConstructionAlgorithm::LibDivSufSort => libdivsufsort_rs::divsufsort64(text).ok_or("Building suffix array failed")? - } - ; + }; // make the SA sparse and decrease the vector size if we have sampling (sampling_rate > 1) if *construction_algorithm == SAConstructionAlgorithm::LibDivSufSort {