Skip to content

Commit

Permalink
fix compression bug
Browse files Browse the repository at this point in the history
  • Loading branch information
supinie committed Apr 15, 2024
1 parent c5303ac commit 58f5d8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/polynomials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ impl<S: State> Default for Poly<S> {

impl<S: State> Poly<S> {
// Sets self to self + x
// The coeffs of self and x should be small enough that no overflow can occur.
// If in doubt, reduce first.
// Example:
// ```
// let new_poly = poly1.add(&poly2);
Expand Down Expand Up @@ -313,7 +315,7 @@ impl Poly<Normalised> {
buf_chunk.copy_from_slice(
&t.chunks_exact(2)
.map(|chunk| chunk[0] | (chunk[1] << 4))
.collect::<ArrayVec<[u8; N]>>()
.collect::<ArrayVec<[u8; 4]>>()
.into_inner(),
);
}
Expand Down Expand Up @@ -350,7 +352,7 @@ impl Poly<Normalised> {
// poly will NOT be normalised, but 0 <= coeffs < 4096
// Example:
// ```
// unpacked_poly = unpack_to_poly(buf);
// unpacked_poly = Poly::unpack(buf);
// ```
pub fn unpack(buf: &[u8]) -> Result<Poly<Unreduced>, PackingError> {
if buf.len() != POLYBYTES {
Expand Down

0 comments on commit 58f5d8c

Please sign in to comment.