-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
350 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::disk::{bits_reader::BitsReader, bits_writer::BitsWriter}; | ||
|
||
use super::DOCUMENT_LENGHTS_EXTENSION; | ||
|
||
pub fn write_doc_lentghts(document_lenghts: &Vec<u32>, output_path: &str) { | ||
let doc_path = output_path.to_string() + DOCUMENT_LENGHTS_EXTENSION; | ||
let mut doc_writer = BitsWriter::new(&doc_path); | ||
|
||
doc_writer.write_vbyte(document_lenghts.len() as u32); | ||
document_lenghts.iter().for_each(|l| { | ||
doc_writer.write_gamma(*l); | ||
}); | ||
|
||
doc_writer.flush(); | ||
} | ||
|
||
pub fn load_document_lenghts(input_path: &str) -> Vec<u32> { | ||
let mut reader = BitsReader::new(&(input_path.to_string() + DOCUMENT_LENGHTS_EXTENSION)); | ||
reader.read_vbyte_gamma_vector() | ||
} |
Oops, something went wrong.