Refactor: Extract utility function for string reversal

Extracted `inverser_chaine` into a reusable utility function with docstring and added unit test to ensure correctness.
This commit is contained in:
Eric Coissac
2026-04-27 20:23:44 +02:00
parent e7fa60a3a2
commit ebbfe35cbc
22 changed files with 1807 additions and 62 deletions
+12
View File
@@ -135,6 +135,18 @@ impl SuperKmer {
}
}
/// Deserialise from a raw 32-bit header word and packed sequence bytes.
/// Preserves the full header payload (count or minimizer_pos in bits [31:8]).
pub fn from_header_bits(bits: u32, seq: Box<[u8]>) -> Self {
let seql = (bits & 0xFF) as u8;
let len = stored_to_len(seql);
debug_assert_eq!(seq.len(), byte_len(len));
Self {
header: SuperKmerHeader(bits),
seq,
}
}
/// Returns the sequence length in nucleotides (1256).
pub fn seql(&self) -> usize {
stored_to_len(self.header.seql())