Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/src/chunked_polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<F: Field> ChunkedPolynomial<F> {
scale *= zeta_n;
}

while coeffs.last().map_or(false, |c| c.is_zero()) {
while coeffs.last().is_some_and(|c| c.is_zero()) {
coeffs.pop();
}

Expand Down
6 changes: 3 additions & 3 deletions utils/src/foreign_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N> {
/// Obtains the big integer representation of the foreign field element
pub fn to_biguint(&self) -> BigUint {
let mut bytes = vec![];
if B % 8 == 0 {
if B.is_multiple_of(8) {
// limbs are stored in little endian
for limb in self.limbs {
let crumb = &limb.to_bytes()[0..B / 8];
Expand All @@ -91,7 +91,7 @@ impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N> {
bits.extend(&f_bits_lower);
}

let bytes_len = if (B * N) % 8 == 0 {
let bytes_len = if (B * N).is_multiple_of(8) {
(B * N) / 8
} else {
((B * N) / 8) + 1
Expand All @@ -108,7 +108,7 @@ impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N> {
/// elements of type `F` in little-endian. Right now it is written
/// so that it gives `N` (limb count) limbs, even if it fits in less bits.
fn big_to_vec(fe: BigUint) -> Vec<F> {
if B % 8 == 0 {
if B.is_multiple_of(8) {
let bytes = fe.to_bytes_le();
let chunks: Vec<&[u8]> = bytes.chunks(B / 8).collect();
chunks
Expand Down
2 changes: 1 addition & 1 deletion utils/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub fn ceil_log2(d: usize) -> usize {

/// This function is bound to be stable soon. See <https://github.com/rust-lang/rust/issues/88581>
pub fn div_ceil(a: usize, b: usize) -> usize {
(a + b - 1) / b
a.div_ceil(b)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just eliminate this function entirely? It doesn't seem to be used within proof-systems. My guess would be some downstream crates might depend on this as an import, but if they're forced to use 1.91 anyway they might as well use the stdlib div_ceil too.

}
Loading