use p3_field::FieldAlgebra;
#[inline]
pub(crate) fn dit_butterfly<FA: FieldAlgebra, const N: usize>(
values: &mut [FA; N],
idx_1: usize,
idx_2: usize,
twiddle: FA::F,
) {
let val_1 = values[idx_1].clone();
let val_2 = values[idx_2].clone() * FA::from_f(twiddle);
values[idx_1] = val_1.clone() + val_2.clone();
values[idx_2] = val_1 - val_2;
}
#[inline]
pub(crate) fn dif_butterfly<FA: FieldAlgebra, const N: usize>(
values: &mut [FA; N],
idx_1: usize,
idx_2: usize,
twiddle: FA::F,
) {
let val_1 = values[idx_1].clone();
let val_2 = values[idx_2].clone();
values[idx_1] = val_1.clone() + val_2.clone();
values[idx_2] = (val_1 - val_2) * FA::from_f(twiddle);
}
#[inline]
pub(crate) fn twiddle_free_butterfly<FA: FieldAlgebra, const N: usize>(
values: &mut [FA; N],
idx_1: usize,
idx_2: usize,
) {
let val_1 = values[idx_1].clone();
let val_2 = values[idx_2].clone();
values[idx_1] = val_1.clone() + val_2.clone();
values[idx_2] = val_1 - val_2;
}