On Tue, Dec 7, 2010 at 10:51 AM, Mike Gibson <mike.gib...@storagecraft.com> wrote: > ... > The vast majority of platforms seem to do arithmetic right shift. It would > be better to have a #define that indicates what the right shifting behavior > is. Only on those platforms where right shift isn't arithmetic would the > slower code be used. > > AFAIK, this sort of thing is determined in the configure step. I can write a > test for it, but I have a suspicion someone may have already done this. > Anyone know? If not, I would appreciate some pointers (or links) on how to > go about adding such a test.
You should be able to test this behavior with AC_COMPILE_IFELSE: ---- dnl **** Check for arithmetic right shifting **** AC_CACHE_CHECK([whether the right shift operator is an arithmetic right shift], wine_cv_arithmetic_right_shift, AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#if ((-4 >> 1) != -2) #error "No simple arithmetic right shift" #endif]], [[]])], [wine_cv_arithmetic_right_shift=yes], [wine_cv_arithmetic_right_shift=no])) if test "$wine_cv_arithmetic_right_shift" = "yes" then AC_DEFINE(HAVE_SIMPLE_ARITHMETIC_RIGHT_SHIFT,1,[Define if the right shift operator is an arithmetic shift]) fi ---- Throw the above in configure.ac and test with "autoconf && autoheader && ./configure". Erich Hoover ehoo...@mines.edu