Skip to content

Commit fb1b9bb

Browse files
Ricard WanderlöfRicard Wanderlof
authored andcommitted
Fix alignment warning when building with --Wcast-align
When building with -Wcast-align, we get a warning because the alignment of st->substate is not known by kiss_fftr_alloc() so shift the data around so that we don't need to care about the alignment for st->substate. Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
1 parent cf5813a commit fb1b9bb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/kiss_fftr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenme
3333
nfft >>= 1;
3434

3535
kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize);
36+
/* nfft kiss_fft_cpx'es for the tmpbuf; half as many for the
37+
* super_twiddles */
3638
memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 3 / 2);
3739

3840
if (lenmem == NULL) {
@@ -45,9 +47,9 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenme
4547
if (!st)
4648
return NULL;
4749

48-
st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */
49-
st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize);
50-
st->super_twiddles = st->tmpbuf + nfft;
50+
st->tmpbuf = (kiss_fft_cpx *) (st + 1); /*just beyond kiss_fftr_state struct */
51+
st->super_twiddles = st->tmpbuf + nfft; /*just beyond tmpbuf */
52+
st->substate = (kiss_fft_cfg) (st->tmpbuf + nfft * 3 / 2); /*just beyond super_twiddles */
5153
kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
5254

5355
for (i = 0; i < nfft/2; ++i) {

0 commit comments

Comments
 (0)