sizeof() can not be used in the pre-compiling constant expression. e.g.
you can not do:

#if sizeof(int) == 4

This is not just for debug build. I checked the assembly code compiled
for Android with original logic, even in release build setting, the
compiler (gcc 4.2 arm-eabi) doesn't optimize away that if with constant
expression. 

fxd

On Wed, 2009-04-29 at 08:14 -0700, Greg Wright wrote:
> Sheldon fu wrote:
> > Overview:
> > 
> > This is a small effort to improve the efficiency of sampler converter. A
> > direct memcpy bypass is added for 16bit to 16bit converting case,
> > similar to what we already have for 32bit to 32bit conversion. Also
> > memcpy bypass is turned on by conditional pre-compiling macro now,
> > instead of 'if' statement. This enables memcpy bypass on compilers that
> > don't do aggressive constant expression optimization and debug build.
> > 
> > Head and Atlas310
> > 
> > fxd
> 
> -#define NBITS_PER_AUDIOSAMPLE (sizeof(tAudioSample)<<3)
> 
> Why exactly does that not work?  I like it better that
> way since it it less prone to future bugs if/when the
> datatypes for audio samples are added or changed, especially
> if this is only needed for DEBUG builds. Does not using
> a const int, or something besides a #define let you use a
> 'if'?
> 
> --greg.
> 
> 
> 
> 
> 


_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to