I'm using FFT calls from the DSP Library for the 6713
(SPRU657)
that say they need the data to be double word aligned.
Im trying to use memory on the stack, which is allocated simply by moving
the stack pointer the amount required.
Im using an array of floats.
I believe that he size of a float is 4 bytes.
I believe that the size of a register on this dsp is 32 bits.
Is a double word 8 bytes?
For double word alignment, the address of the beginning of my array would
need to end in either a zero or an 8?
Im allocating extra elements in my float array and shifting my pointer
forward by up to 8 bytes to have the data Im working with be properly
aligned.
Does this seem like it should work, leaving me with a properly aligned and
valid array that I can address using the FFTData pointer?
float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows me
to align the array properly for the DSP FFT routine
unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
ptrAlignmentAdjustment &= 0xFFFFFFF8;
float * FFTData = (float *)ptrAlignmentAdjustment;
Is there a better way of doing this?
This code is replacing has a globally defined symbol that was aligned. The
problem is that I'm tight on memory, and would like to reuse this memory
for
something else in the course of the routine.
#pragma DATA_ALIGN(8);
float FFTData[2*FFTCOMPLEXPOINTCOUNT];
I tried using code where the ptrAlignmentAdjustment was declared as a void *
which seemed to me to be better, but I couldn't figure out how to mask
the
last three bits to zero when I did it that way. The compiler kept telling
me it was an error.
void * ptrAlignmentAdjustment = FFTDataStorage+2;
ptrAlignmentAdjustment &= 0xFFFFFFF8;
float * FFTData = (float *)ptrAlignmentAdjustment;
produced the error "expression must have integral or enum type" on the line
where I was trying to mask the pointer value.
Thanks for any input.
Wim.
Using aligned memory on the stack for FFT calls.
Started by ●September 4, 2009
Reply by ●September 4, 20092009-09-04
Wim,
FYI - I will add some 'excess details' for the benefit of others.
On Fri, Sep 4, 2009 at 3:36 PM, William C Bonner wrote:
> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
> they need the data to be double word aligned.
>
> Im trying to use memory on the stack, which is allocated simply by moving
> the stack pointer the amount required.
>
> Im using an array of floats.
>
> I believe that he size of a float is 4 bytes.
sizeof float=4 bytes, double=8 bytes
>
> I believe that the size of a register on this dsp is 32 bits.
std regs [A0-B31] = 32 bits
>
> Is a double word 8 bytes?
yes.
word = int = 32 bits/4 bytes. double=64bits/8bytes
>
> For double word alignment, the address of the beginning of my array would
> need to end in either a zero or an 8?
yes.
>
> Im allocating extra elements in my float array and shifting my pointer
> forward by up to 8 bytes to have the data Im working with be properly
> aligned.
If I understand your problem correctly, You can use a pragma to
allocate on a double word boundary and then forget about alignment
issues.
>
> Does this seem like it should work, leaving me with a properly aligned and
> valid array that I can address using the FFTData pointer?
If you define a 'double word array', I would expect that the compiler
will align it for you just like it does for double variables.
>
> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows me
> to align the array properly for the DSP FFT routine
> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> Is there a better way of doing this?
>
> This code is replacing has a globally defined symbol that was aligned. The
> problem is that I'm tight on memory, and would like to reuse this memory for
> something else in the course of the routine.
>
> #pragma DATA_ALIGN(8);
> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>
> I tried using code where the ptrAlignmentAdjustment was declared as a void *
> which seemed to me to be better, but I couldn't figure out how to mask the
> last three bits to zero when I did it that way. The compiler kept telling
> me it was an error.
>
> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> produced the error "expression must have integral or enum type" on the line
> where I was trying to mask the pointer value.
>
> Thanks for any input.
Whatever you do, double align your data. If you do some hocus pocus to
work on non aligned data, it will add some amount of code>0 bytes and
be subject to performance, reliability, and maintainability problems.
mikedunn
>
> Wim.
>
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
_____________________________________
FYI - I will add some 'excess details' for the benefit of others.
On Fri, Sep 4, 2009 at 3:36 PM, William C Bonner wrote:
> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
> they need the data to be double word aligned.
>
> Im trying to use memory on the stack, which is allocated simply by moving
> the stack pointer the amount required.
>
> Im using an array of floats.
>
> I believe that he size of a float is 4 bytes.
sizeof float=4 bytes, double=8 bytes
>
> I believe that the size of a register on this dsp is 32 bits.
std regs [A0-B31] = 32 bits
>
> Is a double word 8 bytes?
yes.
word = int = 32 bits/4 bytes. double=64bits/8bytes
>
> For double word alignment, the address of the beginning of my array would
> need to end in either a zero or an 8?
yes.
>
> Im allocating extra elements in my float array and shifting my pointer
> forward by up to 8 bytes to have the data Im working with be properly
> aligned.
If I understand your problem correctly, You can use a pragma to
allocate on a double word boundary and then forget about alignment
issues.
>
> Does this seem like it should work, leaving me with a properly aligned and
> valid array that I can address using the FFTData pointer?
If you define a 'double word array', I would expect that the compiler
will align it for you just like it does for double variables.
>
> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows me
> to align the array properly for the DSP FFT routine
> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> Is there a better way of doing this?
>
> This code is replacing has a globally defined symbol that was aligned. The
> problem is that I'm tight on memory, and would like to reuse this memory for
> something else in the course of the routine.
>
> #pragma DATA_ALIGN(8);
> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>
> I tried using code where the ptrAlignmentAdjustment was declared as a void *
> which seemed to me to be better, but I couldn't figure out how to mask the
> last three bits to zero when I did it that way. The compiler kept telling
> me it was an error.
>
> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> produced the error "expression must have integral or enum type" on the line
> where I was trying to mask the pointer value.
>
> Thanks for any input.
Whatever you do, double align your data. If you do some hocus pocus to
work on non aligned data, it will add some amount of code>0 bytes and
be subject to performance, reliability, and maintainability problems.
mikedunn
>
> Wim.
>
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
_____________________________________
Reply by ●September 4, 20092009-09-04
William,
I think using the stack for an aligned value is an error.
Rather, allocate some static memory, using the align pragma (or the linker parameters) to properly place the data.
R. Williams
---------- Original Message -----------
From: William C Bonner
To: C6x
Sent: Fri, 4 Sep 2009 13:36:33 -0700
Subject: [c6x] Using aligned memory on the stack for FFT calls.
>
>
> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say they need the data to be double word aligned.
>
> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated simply by moving the stack pointer the amount required.
>
> [WINDOWS-1252?]Im using an array of floats.
>
> I believe that he size of a float is 4 bytes.
>
> I believe that the size of a register on this dsp is 32 bits.
>
> Is a double word 8 bytes?
>
> For double word alignment, the address of the beginning of my array would need to end in either a zero or an 8?
>
> [WINDOWS-1252?]Im allocating extra elements in my float array and shifting my pointer forward by up to 8 bytes to have the data [WINDOWS-1252?]Im working with be properly aligned.
>
> Does this seem like it should work, leaving me with a properly aligned and valid array that I can address using the FFTData pointer?
>
> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows me to align the array properly for the DSP FFT routine
> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> Is there a better way of doing this?
>
> This code is replacing has a globally defined symbol that was aligned. The problem is that I'm tight on memory, and would like to reuse this memory for something else in the course of the routine.
>
> #pragma DATA_ALIGN(8);
> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>
> I tried using code where the ptrAlignmentAdjustment was declared as a void * which seemed to me to be better, but I couldn't figure out how to mask the last three bits to zero when I did it that way. The compiler kept telling me it was an error.
>
> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> produced the error "expression must have integral or enum type" on the line where I was trying to mask the pointer value.
>
> Thanks for any input.
>
> Wim.
------- End of Original Message -------
I think using the stack for an aligned value is an error.
Rather, allocate some static memory, using the align pragma (or the linker parameters) to properly place the data.
R. Williams
---------- Original Message -----------
From: William C Bonner
To: C6x
Sent: Fri, 4 Sep 2009 13:36:33 -0700
Subject: [c6x] Using aligned memory on the stack for FFT calls.
>
>
> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say they need the data to be double word aligned.
>
> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated simply by moving the stack pointer the amount required.
>
> [WINDOWS-1252?]Im using an array of floats.
>
> I believe that he size of a float is 4 bytes.
>
> I believe that the size of a register on this dsp is 32 bits.
>
> Is a double word 8 bytes?
>
> For double word alignment, the address of the beginning of my array would need to end in either a zero or an 8?
>
> [WINDOWS-1252?]Im allocating extra elements in my float array and shifting my pointer forward by up to 8 bytes to have the data [WINDOWS-1252?]Im working with be properly aligned.
>
> Does this seem like it should work, leaving me with a properly aligned and valid array that I can address using the FFTData pointer?
>
> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows me to align the array properly for the DSP FFT routine
> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> Is there a better way of doing this?
>
> This code is replacing has a globally defined symbol that was aligned. The problem is that I'm tight on memory, and would like to reuse this memory for something else in the course of the routine.
>
> #pragma DATA_ALIGN(8);
> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>
> I tried using code where the ptrAlignmentAdjustment was declared as a void * which seemed to me to be better, but I couldn't figure out how to mask the last three bits to zero when I did it that way. The compiler kept telling me it was an error.
>
> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> float * FFTData = (float *)ptrAlignmentAdjustment;
>
> produced the error "expression must have integral or enum type" on the line where I was trying to mask the pointer value.
>
> Thanks for any input.
>
> Wim.
------- End of Original Message -------
Reply by ●September 4, 20092009-09-04
Wim,
Richard is correct - I totally spaced the stack reference. Not sure
why you would do that.
mikedunn
On Fri, Sep 4, 2009 at 4:34 PM, Richard Williams wrote:
> William,
>
> I think using the stack for an aligned value is an error.
> Rather, allocate some static memory, using the align pragma (or the linker
> parameters) to properly place the data.
>
> R. Williams
>
> ---------- Original Message -----------
> From: William C Bonner
> To: C6x
> Sent: Fri, 4 Sep 2009 13:36:33 -0700
> Subject: [c6x] Using aligned memory on the stack for FFT calls.
>
>> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
>> they need the data to be double word aligned.
>>
>> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated
>> simply by moving the stack pointer the amount required.
>>
>> [WINDOWS-1252?]Im using an array of floats.
>>
>> I believe that he size of a float is 4 bytes.
>>
>> I believe that the size of a register on this dsp is 32 bits.
>>
>> Is a double word 8 bytes?
>>
>> For double word alignment, the address of the beginning of my array would
>> need to end in either a zero or an 8?
>>
>> [WINDOWS-1252?]Im allocating extra elements in my float array and
>> shifting my pointer forward by up to 8 bytes to have the data
>> [WINDOWS-1252?]Im working with be properly aligned.
>>
>> Does this seem like it should work, leaving me with a properly aligned and
>> valid array that I can address using the FFTData pointer?
>>
>> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows
>> me to align the array properly for the DSP FFT routine
>> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
>> ptrAlignmentAdjustment &= 0xFFFFFFF8;
>> float * FFTData = (float *)ptrAlignmentAdjustment;
>>
>> Is there a better way of doing this?
>>
>> This code is replacing has a globally defined symbol that was aligned. The
>> problem is that I'm tight on memory, and would like to reuse this memory for
>> something else in the course of the routine.
>>
>> #pragma DATA_ALIGN(8);
>> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>>
>> I tried using code where the ptrAlignmentAdjustment was declared as a void
>> * which seemed to me to be better, but I couldn't figure out how to mask the
>> last three bits to zero when I did it that way. The compiler kept telling
>> me it was an error.
>>
>> void * ptrAlignmentAdjustment = FFTDataStorage+2;
>> ptrAlignmentAdjustment &= 0xFFFFFFF8;
>> float * FFTData = (float *)ptrAlignmentAdjustment;
>>
>> produced the error "expression must have integral or enum type" on the
>> line where I was trying to mask the pointer value.
>>
>> Thanks for any input.
>>
>> Wim.
> ------- End of Original Message -------
>
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
_____________________________________
Richard is correct - I totally spaced the stack reference. Not sure
why you would do that.
mikedunn
On Fri, Sep 4, 2009 at 4:34 PM, Richard Williams wrote:
> William,
>
> I think using the stack for an aligned value is an error.
> Rather, allocate some static memory, using the align pragma (or the linker
> parameters) to properly place the data.
>
> R. Williams
>
> ---------- Original Message -----------
> From: William C Bonner
> To: C6x
> Sent: Fri, 4 Sep 2009 13:36:33 -0700
> Subject: [c6x] Using aligned memory on the stack for FFT calls.
>
>> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
>> they need the data to be double word aligned.
>>
>> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated
>> simply by moving the stack pointer the amount required.
>>
>> [WINDOWS-1252?]Im using an array of floats.
>>
>> I believe that he size of a float is 4 bytes.
>>
>> I believe that the size of a register on this dsp is 32 bits.
>>
>> Is a double word 8 bytes?
>>
>> For double word alignment, the address of the beginning of my array would
>> need to end in either a zero or an 8?
>>
>> [WINDOWS-1252?]Im allocating extra elements in my float array and
>> shifting my pointer forward by up to 8 bytes to have the data
>> [WINDOWS-1252?]Im working with be properly aligned.
>>
>> Does this seem like it should work, leaving me with a properly aligned and
>> valid array that I can address using the FFTData pointer?
>>
>> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This allows
>> me to align the array properly for the DSP FFT routine
>> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
>> ptrAlignmentAdjustment &= 0xFFFFFFF8;
>> float * FFTData = (float *)ptrAlignmentAdjustment;
>>
>> Is there a better way of doing this?
>>
>> This code is replacing has a globally defined symbol that was aligned. The
>> problem is that I'm tight on memory, and would like to reuse this memory for
>> something else in the course of the routine.
>>
>> #pragma DATA_ALIGN(8);
>> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
>>
>> I tried using code where the ptrAlignmentAdjustment was declared as a void
>> * which seemed to me to be better, but I couldn't figure out how to mask the
>> last three bits to zero when I did it that way. The compiler kept telling
>> me it was an error.
>>
>> void * ptrAlignmentAdjustment = FFTDataStorage+2;
>> ptrAlignmentAdjustment &= 0xFFFFFFF8;
>> float * FFTData = (float *)ptrAlignmentAdjustment;
>>
>> produced the error "expression must have integral or enum type" on the
>> line where I was trying to mask the pointer value.
>>
>> Thanks for any input.
>>
>> Wim.
> ------- End of Original Message -------
>
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
_____________________________________
Reply by ●September 5, 20092009-09-05
I was originally using the globally defined array with the pragma specifying
the alignment.
My system is constrained on memory for what I want to do, and operating in
the L2 ram of the DSP is significantly faster than using external memory.
After I have run the FFT operation, because of output symmetry related to
the fact that the input data only has real data, while the output is
complex, I only care about the first third of the FFTData array.
main()
|-Acquire Data
|-Data Prep
| |-FFT
|-FirstCrunchingSubroutine
|-SecondCrunchingSubroutine
I've tried to show the main loop, and the memory stack that happens in the
tree list above. My FFT call is inside the DataPrep function, and there are
other calls inside each of the other CrunchingSubRoutines. Actually, all of
these are several call levels deeper than the main() function, but I'm just
trying to get a generalized working solution that doesn't require memory to
be permanently allocated for a block just for the FFT.
Wim.
On Fri, Sep 4, 2009 at 4:39 PM, Michael Dunn wrote:
> Wim,
>
> Richard is correct - I totally spaced the stack reference. Not sure
> why you would do that.
>
> mikedunn
>
> On Fri, Sep 4, 2009 at 4:34 PM, Richard Williams
> wrote:
> >
> >
> > William,
> >
> > I think using the stack for an aligned value is an error.
> > Rather, allocate some static memory, using the align pragma (or the
> linker
> > parameters) to properly place the data.
> >
> > R. Williams
> >
> >
> >
> > ---------- Original Message -----------
> > From: William C Bonner
> > To: C6x
> > Sent: Fri, 4 Sep 2009 13:36:33 -0700
> > Subject: [c6x] Using aligned memory on the stack for FFT calls.
> >
> >>
> >>
> >> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
> >> they need the data to be double word aligned.
> >>
> >> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated
> >> simply by moving the stack pointer the amount required.
> >>
> >> [WINDOWS-1252?]Im using an array of floats.
> >>
> >> I believe that he size of a float is 4 bytes.
> >>
> >> I believe that the size of a register on this dsp is 32 bits.
> >>
> >> Is a double word 8 bytes?
> >>
> >> For double word alignment, the address of the beginning of my array
> would
> >> need to end in either a zero or an 8?
> >>
> >> [WINDOWS-1252?]Im allocating extra elements in my float array and
> >> shifting my pointer forward by up to 8 bytes to have the data
> >> [WINDOWS-1252?]Im working with be properly aligned.
> >>
> >> Does this seem like it should work, leaving me with a properly aligned
> and
> >> valid array that I can address using the FFTData pointer?
> >>
> >> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This
> allows
> >> me to align the array properly for the DSP FFT routine
> >> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> >> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> >> float * FFTData = (float *)ptrAlignmentAdjustment;
> >>
> >> Is there a better way of doing this?
> >>
> >> This code is replacing has a globally defined symbol that was aligned.
> The
> >> problem is that I'm tight on memory, and would like to reuse this memory
> for
> >> something else in the course of the routine.
> >>
> >> #pragma DATA_ALIGN(8);
> >> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
> >>
> >> I tried using code where the ptrAlignmentAdjustment was declared as a
> void
> >> * which seemed to me to be better, but I couldn't figure out how to mask
> the
> >> last three bits to zero when I did it that way. The compiler kept
> telling
> >> me it was an error.
> >>
> >> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> >> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> >> float * FFTData = (float *)ptrAlignmentAdjustment;
> >>
> >> produced the error "expression must have integral or enum type" on the
> >> line where I was trying to mask the pointer value.
> >>
> >> Thanks for any input.
> >>
> >> Wim.
> >>
> >>
> > ------- End of Original Message -------
>
the alignment.
My system is constrained on memory for what I want to do, and operating in
the L2 ram of the DSP is significantly faster than using external memory.
After I have run the FFT operation, because of output symmetry related to
the fact that the input data only has real data, while the output is
complex, I only care about the first third of the FFTData array.
main()
|-Acquire Data
|-Data Prep
| |-FFT
|-FirstCrunchingSubroutine
|-SecondCrunchingSubroutine
I've tried to show the main loop, and the memory stack that happens in the
tree list above. My FFT call is inside the DataPrep function, and there are
other calls inside each of the other CrunchingSubRoutines. Actually, all of
these are several call levels deeper than the main() function, but I'm just
trying to get a generalized working solution that doesn't require memory to
be permanently allocated for a block just for the FFT.
Wim.
On Fri, Sep 4, 2009 at 4:39 PM, Michael Dunn wrote:
> Wim,
>
> Richard is correct - I totally spaced the stack reference. Not sure
> why you would do that.
>
> mikedunn
>
> On Fri, Sep 4, 2009 at 4:34 PM, Richard Williams
> wrote:
> >
> >
> > William,
> >
> > I think using the stack for an aligned value is an error.
> > Rather, allocate some static memory, using the align pragma (or the
> linker
> > parameters) to properly place the data.
> >
> > R. Williams
> >
> >
> >
> > ---------- Original Message -----------
> > From: William C Bonner
> > To: C6x
> > Sent: Fri, 4 Sep 2009 13:36:33 -0700
> > Subject: [c6x] Using aligned memory on the stack for FFT calls.
> >
> >>
> >>
> >> I'm using FFT calls from the DSP Library for the 6713 (SPRU657) that say
> >> they need the data to be double word aligned.
> >>
> >> [WINDOWS-1252?]Im trying to use memory on the stack, which is allocated
> >> simply by moving the stack pointer the amount required.
> >>
> >> [WINDOWS-1252?]Im using an array of floats.
> >>
> >> I believe that he size of a float is 4 bytes.
> >>
> >> I believe that the size of a register on this dsp is 32 bits.
> >>
> >> Is a double word 8 bytes?
> >>
> >> For double word alignment, the address of the beginning of my array
> would
> >> need to end in either a zero or an 8?
> >>
> >> [WINDOWS-1252?]Im allocating extra elements in my float array and
> >> shifting my pointer forward by up to 8 bytes to have the data
> >> [WINDOWS-1252?]Im working with be properly aligned.
> >>
> >> Does this seem like it should work, leaving me with a properly aligned
> and
> >> valid array that I can address using the FFTData pointer?
> >>
> >> float FFTDataStorage[2*FFTCOMPLEXPOINTCOUNT+3] = {0}; //HACK: This
> allows
> >> me to align the array properly for the DSP FFT routine
> >> unsigned int ptrAlignmentAdjustment = (unsigned int)(FFTDataStorage+2);
> >> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> >> float * FFTData = (float *)ptrAlignmentAdjustment;
> >>
> >> Is there a better way of doing this?
> >>
> >> This code is replacing has a globally defined symbol that was aligned.
> The
> >> problem is that I'm tight on memory, and would like to reuse this memory
> for
> >> something else in the course of the routine.
> >>
> >> #pragma DATA_ALIGN(8);
> >> float FFTData[2*FFTCOMPLEXPOINTCOUNT];
> >>
> >> I tried using code where the ptrAlignmentAdjustment was declared as a
> void
> >> * which seemed to me to be better, but I couldn't figure out how to mask
> the
> >> last three bits to zero when I did it that way. The compiler kept
> telling
> >> me it was an error.
> >>
> >> void * ptrAlignmentAdjustment = FFTDataStorage+2;
> >> ptrAlignmentAdjustment &= 0xFFFFFFF8;
> >> float * FFTData = (float *)ptrAlignmentAdjustment;
> >>
> >> produced the error "expression must have integral or enum type" on the
> >> line where I was trying to mask the pointer value.
> >>
> >> Thanks for any input.
> >>
> >> Wim.
> >>
> >>
> > ------- End of Original Message -------
>