Skip to content

Commit 22e880d

Browse files
committed
Rename CHUNK_SIZE to SIMD_WIDTH to avoid confusion
1 parent f07c3b7 commit 22e880d

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

.cargo/config

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/twiddles.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ pub fn generate_twiddles(dist: usize) -> (Vec<f64>, Vec<f64>) {
7171
}
7272

7373
pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
74-
const CHUNK_SIZE: usize = 8; // TODO: make this a const generic?
75-
assert!(dist >= CHUNK_SIZE * 2);
76-
assert_eq!(dist % CHUNK_SIZE, 0);
74+
const SIMD_WIDTH: usize = 8; // TODO: make this a const generic?
75+
assert!(dist >= SIMD_WIDTH * 2);
76+
assert_eq!(dist % SIMD_WIDTH, 0);
7777
let mut twiddles_re = vec![0.0; dist];
7878
let mut twiddles_im = vec![0.0; dist];
7979
twiddles_re[0] = 1.0;
@@ -97,7 +97,7 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
9797
};
9898

9999
let apply_symmetry_im = |input: &[Float], output: &mut [Float]| {
100-
let mut buf: [Float; CHUNK_SIZE] = [Float::default(); 8];
100+
let mut buf: [Float; SIMD_WIDTH] = [Float::default(); SIMD_WIDTH];
101101
buf.copy_from_slice(input);
102102
buf.reverse();
103103
output.copy_from_slice(&buf);
@@ -110,16 +110,16 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
110110
assert!(first_half_im.len() == second_half_im.len() + 1);
111111

112112
first_half_re
113-
.chunks_exact_mut(CHUNK_SIZE)
114-
.zip(first_half_im.chunks_exact_mut(CHUNK_SIZE))
113+
.chunks_exact_mut(SIMD_WIDTH)
114+
.zip(first_half_im.chunks_exact_mut(SIMD_WIDTH))
115115
.zip(
116-
second_half_re[CHUNK_SIZE - 1..]
117-
.chunks_exact_mut(CHUNK_SIZE)
116+
second_half_re[SIMD_WIDTH - 1..]
117+
.chunks_exact_mut(SIMD_WIDTH)
118118
.rev(),
119119
)
120120
.zip(
121-
second_half_im[CHUNK_SIZE - 1..]
122-
.chunks_exact_mut(CHUNK_SIZE)
121+
second_half_im[SIMD_WIDTH - 1..]
122+
.chunks_exact_mut(SIMD_WIDTH)
123123
.rev(),
124124
)
125125
.for_each(
@@ -141,9 +141,9 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
141141
);
142142

143143
// Fill in the middle that the SIMD loop didn't
144-
twiddles_re[dist / 2 - CHUNK_SIZE + 1..][..(CHUNK_SIZE * 2) - 1]
144+
twiddles_re[dist / 2 - SIMD_WIDTH + 1..][..(SIMD_WIDTH * 2) - 1]
145145
.iter_mut()
146-
.zip(twiddles_im[dist / 2 - CHUNK_SIZE + 1..][..(CHUNK_SIZE * 2) - 1].iter_mut())
146+
.zip(twiddles_im[dist / 2 - SIMD_WIDTH + 1..][..(SIMD_WIDTH * 2) - 1].iter_mut())
147147
.for_each(|(re, im)| {
148148
(*re, *im) = next_twiddle();
149149
});

0 commit comments

Comments
 (0)