[Insight-developers] Rounding functions in itkMacro.h

Tom Vercauteren tom.vercauteren at m4x.org
Wed May 20 10:57:38 EDT 2009


Hi Sean,

Thanks for the feedback.

>>Absolutely right, what we should test is whether we are on a x86
>>platform. Changing
>>  #if defined(__GNUC__) && (!defined(__GCCXML__)) &&
>>(!defined(__ppc__)) && (!defined(__ppc64__))
>>by something like
>>  #if defined(__GNUC__) && (!defined(__GCCXML__)) &&  (defined(i386)
>>|| defined(__i386__) || defined(__i386) || defined(__x86_64__) ||
>>defined(__x86_64))
>>in vnl_math.h would indeed make more sense. I am just not completely
>>sure what the correct way for testing for x86 with gcc is. There might
>>be a better cmake way of doing this. Also I won't be here to track
>>potential dashboard failures until next Monday.
>
> On OS X, defined(__i386__) || defined(__x86_64__) would do the trick,
> and is what Apple uses in their headers.  I'm not sure if that's a gcc
> thing or an Apple thing though.

These defines are from gcc I think. They can be accessed with the
following command:
  echo "" | g++ -E -dM -x c++ - | sort | grep 86

What I get from it follows:

Linux 32 bits, intel machine (gcc 4.1 or 4.3):
#define __i386 1
#define __i386__ 1
#define i386 1
#define __i486 1
#define __i486__ 1

Linux 64 bits, amd 64 machine (gcc 4.1 or 4.3):
#define __x86_64 1
#define __x86_64__ 1

Mac OS 10.5 32 bits, intel machine (gcc 4.0):
#define __i386 1
#define __i386__ 1
#define i386 1

I am not sure why they are three version of the i386 define and two of
the x86_64. That's why I was proposing to use an OR on all of them.

Tom


More information about the Insight-developers mailing list