Skip to content

Commit

Permalink
bcf/record/samples/series: Fix start range calcuation
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Mar 21, 2024
1 parent 708be31 commit 1b1eb39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions noodles-bcf/src/record/samples/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn read_string_map_index(src: &mut &[u8]) -> io::Result<usize> {

fn range<N>(i: usize, len: usize) -> Range<usize> {
let size = mem::size_of::<N>();
let start = size * i;
let start = size * i * len;
let end = start + size * len;
start..end
}
Expand Down Expand Up @@ -259,6 +259,7 @@ fn get_string_value(src: &[u8], len: usize, i: usize) -> Option<Option<Value<'_>
fn get_genotype_value(src: &[u8], len: usize, i: usize) -> Option<Option<Value<'_>>> {
use self::value::Genotype;

let src = src.get(range::<i8>(i, len))?;
dbg!(src, i, len);
let src = src.get(dbg!(range::<i8>(i, len)))?;
Some(Some(Value::Genotype(Box::new(Genotype::new(src)))))
}

0 comments on commit 1b1eb39

Please sign in to comment.