mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-08-05 05:44:56 -04:00
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>
This commit is contained in:
committed by
Ricard Wanderlof
parent
cf5813a1b4
commit
31018eaea6
@ -33,6 +33,8 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenme
|
|||||||
nfft >>= 1;
|
nfft >>= 1;
|
||||||
|
|
||||||
kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize);
|
kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize);
|
||||||
|
/* nfft kiss_fft_cpx'es for the tmpbuf; half as many for the
|
||||||
|
* super_twiddles */
|
||||||
memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 3 / 2);
|
memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 3 / 2);
|
||||||
|
|
||||||
if (lenmem == NULL) {
|
if (lenmem == NULL) {
|
||||||
@ -45,9 +47,9 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenme
|
|||||||
if (!st)
|
if (!st)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */
|
st->tmpbuf = (kiss_fft_cpx *) (st + 1); /*just beyond kiss_fftr_state struct */
|
||||||
st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize);
|
st->super_twiddles = st->tmpbuf + nfft; /*just beyond tmpbuf */
|
||||||
st->super_twiddles = st->tmpbuf + nfft;
|
st->substate = (kiss_fft_cfg) (st->tmpbuf + nfft * 3 / 2); /*just beyond super_twiddles */
|
||||||
kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
|
kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
|
||||||
|
|
||||||
for (i = 0; i < nfft/2; ++i) {
|
for (i = 0; i < nfft/2; ++i) {
|
||||||
|
Reference in New Issue
Block a user