diff --git a/sa-builder/src/bitpacking.rs b/sa-builder/src/bitpacking.rs index f53f0fe..192d918 100644 --- a/sa-builder/src/bitpacking.rs +++ b/sa-builder/src/bitpacking.rs @@ -9,7 +9,7 @@ fn get_rank(c: u8) -> u8 { } } -const BITS_PER_CHAR: usize = 5; +pub const BITS_PER_CHAR: usize = 5; pub fn bitpack_text(text: &Vec, sparseness_factor: u8) -> Vec { let sparseness_factor = sparseness_factor as usize; let num_ints = (text.len() + (sparseness_factor-1)) / sparseness_factor; diff --git a/sa-builder/src/lib.rs b/sa-builder/src/lib.rs index 2c4871b..97dcb93 100644 --- a/sa-builder/src/lib.rs +++ b/sa-builder/src/lib.rs @@ -1,5 +1,6 @@ use std::error::Error; use crate::bitpacking::bitpack_text; +use crate::bitpacking::BITS_PER_CHAR; use clap::{Parser, ValueEnum}; pub mod bitpacking; @@ -58,10 +59,8 @@ pub fn build_ssa( // Build the suffix array using the selected algorithm let mut sa = match construction_algorithm { SAConstructionAlgorithm::LibSais => { - let bits_per_char = 5; - let sparseness_factor = 4; let mut packed_text = bitpack_text(text, sparseness_factor); - libsais64_rs::sais64_long(&mut packed_text, 1 << (bits_per_char * sparseness_factor)) + libsais64_rs::sais64_long(&mut packed_text, 1 << (BITS_PER_CHAR * sparseness_factor as usize)) }, SAConstructionAlgorithm::LibDivSufSort => libdivsufsort_rs::divsufsort64(text) }