Skip to content

Commit

Permalink
Small simplification of read_huffman_vq
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Oct 7, 2018
1 parent 3774477 commit b88f04c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,12 @@ impl <'a> BitpackCursor <'a> {
Ok(v) => v as usize,
Err(_) => return Err(HuffmanVqReadErr::EndOfPacket),
};
let codebook_vq_lookup_vec :&Vec<f32> = match b.codebook_vq_lookup_vec.as_ref() {
let codebook_vq_lookup_vec :&[f32] = match b.codebook_vq_lookup_vec.as_ref() {
Some(ref v) => v,
None => return Err(HuffmanVqReadErr::NoVqLookupForCodebook),
};
return Ok(&codebook_vq_lookup_vec[
idx * b.codebook_dimensions as usize ..
(idx as usize + 1) * b.codebook_dimensions as usize]);
let dim = b.codebook_dimensions as usize;
return Ok(&codebook_vq_lookup_vec[idx * dim .. (idx + 1) * dim]);
}
}

Expand Down

0 comments on commit b88f04c

Please sign in to comment.