Skip to content

Commit

Permalink
allowed uneven slices in batch inverse (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad-starkware authored Mar 21, 2024
1 parent 9079231 commit 82fe65e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ pub trait FieldExpOps: Mul<Output = Self> + MulAssign + Sized + One + Copy {
fn batch_inverse(column: &[Self], dst: &mut [Self]) {
const WIDTH: usize = 4;
let n = column.len();
debug_assert!(n.is_power_of_two());
debug_assert!(dst.len() >= n);

if n <= WIDTH {
if n <= WIDTH || n % WIDTH != 0 {
batch_inverse_classic(column, dst);
return;
}
Expand Down Expand Up @@ -75,8 +74,7 @@ pub trait FieldExpOps: Mul<Output = Self> + MulAssign + Sized + One + Copy {
/// Assumes dst is initialized and of the same length as column.
fn batch_inverse_classic<T: FieldExpOps>(column: &[T], dst: &mut [T]) {
let n = column.len();
debug_assert!(n.is_power_of_two());
debug_assert_eq!(dst.len(), n);
debug_assert!(dst.len() >= n);

dst[0] = column[0];
// First pass.
Expand Down

0 comments on commit 82fe65e

Please sign in to comment.