[FFmpeg-cvslog] r11889 - trunk/libavutil/mem.h

Diego Biurrun diego
Sun Feb 10 22:50:35 CET 2008


On Sun, Feb 10, 2008 at 11:47:01PM +0200, Uoti Urpala wrote:
> On Sun, 2008-02-10 at 22:16 +0100, Diego Biurrun wrote:
> > On Sun, Feb 10, 2008 at 10:11:52PM +0100, Diego Biurrun wrote:
> > > Wait, icc defines __GNUC__?!?
> > 
> > I suggest the following, which is farm more readable IMO even if -
> > strictly speaking - it duplicates one line:
> > 
> > #ifdef __GNUC__
> >   #define DECLARE_ALIGNED(n,t,v)       t v __attribute__ ((aligned (n)))
> >   #define DECLARE_ASM_CONST(n,t,v)     static const t v attribute_used __attribute__ ((aligned (n)))
> > #elif __ICC
> 
> icc does define __GNUC__ as it tries to support the same extensions. So
> if there is a test for __GNUC__, any icc-specific code must be on the
> __GNUC__ side, not the non-__GNUC__ side like in your suggestion.

Then it can be done the other way around:

#ifdef __ICC
  #define DECLARE_ALIGNED(n,t,v)       t v __attribute__ ((aligned (n)))
  #define DECLARE_ASM_CONST(n,t,v)     const t __attribute__ ((aligned (n))) v
#elif __GNUC__
  #define DECLARE_ALIGNED(n,t,v)       t v __attribute__ ((aligned (n)))
  #define DECLARE_ASM_CONST(n,t,v)     static const t v attribute_used __attribute__ ((aligned (n)))
#else
  #define DECLARE_ALIGNED(n,t,v)       __declspec(align(n)) t v
  #define DECLARE_ASM_CONST(n,t,v)     __declspec(align(n)) static const t v
#endif

Diego




More information about the ffmpeg-cvslog mailing list