Skip to content

Commit

Permalink
satisfy linter; opaque FieldElt type; simplify control into_query_field"
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed Jan 30, 2025
1 parent 3935f75 commit 47fa03d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions saffron/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct QueryBytes {
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Debug)]
/// We store the data in a vector of vector of field element
/// The inner vector represent polynomials
pub struct FieldElt {
struct FieldElt {
/// the index of the polynomial the data point is attached too
poly_index: usize,
/// the index of the root of unity the data point is attached too
Expand Down Expand Up @@ -146,14 +146,6 @@ impl QueryBytes {
n_polys,
}
};
if start.poly_index >= n_polys {
return Err(QueryError::QueryOutOfBounds {
poly_index: start.poly_index,
eval_index: start.eval_index,
n_polys,
domain_size,
});
};
let byte_end = self.start + self.len;
let end = {
let end_field_nb = byte_end / n;
Expand All @@ -164,7 +156,8 @@ impl QueryBytes {
n_polys,
}
};
if end.poly_index >= n_polys {

if start.poly_index >= n_polys || end.poly_index >= n_polys {
return Err(QueryError::QueryOutOfBounds {
poly_index: end.poly_index,
eval_index: end.eval_index,
Expand Down Expand Up @@ -197,6 +190,10 @@ pub mod test_utils {
pub fn len(&self) -> usize {
self.0.len()
}

pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 47fa03d

Please sign in to comment.