[xiph-commits] r17578 - in trunk/theora/lib: . x86

tterribe at svn.xiph.org tterribe at svn.xiph.org
Thu Oct 28 21:21:27 PDT 2010


Author: tterribe
Date: 2010-10-28 21:21:26 -0700 (Thu, 28 Oct 2010)
New Revision: 17578

Modified:
   trunk/theora/lib/internal.h
   trunk/theora/lib/mathops.h
   trunk/theora/lib/x86/x86int.h
Log:
#define __GNUC_PREREQ ourselves.

On non-glibc systems (Android), the system headers won't do it for us.
This also simplifies its use, since we can guarantee it's always #define'd
 (i.e., as 0 on non-gcc builds).


Modified: trunk/theora/lib/internal.h
===================================================================
--- trunk/theora/lib/internal.h	2010-10-29 04:00:07 UTC (rev 17577)
+++ trunk/theora/lib/internal.h	2010-10-29 04:21:26 UTC (rev 17578)
@@ -25,6 +25,15 @@
 # include "theora/theora.h"
 # include "ocintrin.h"
 
+# if !defined(__GNUC_PREREQ)
+#  if defined(__GNUC__)&&defined(__GNUC_MINOR__)
+#   define __GNUC_PREREQ(_maj,_min) \
+ ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
+#  else
+#   define __GNUC_PREREQ(_maj,_min) 0
+#  endif
+# endif
+
 # if defined(_MSC_VER)
 /*Disable missing EMMS warnings.*/
 #  pragma warning(disable:4799)
@@ -32,10 +41,8 @@
 #  pragma warning(disable:4554)
 # endif
 /*You, too, gcc.*/
-# if defined(__GNUC_PREREQ)
-#  if __GNUC_PREREQ(4,2)
-#   pragma GCC diagnostic ignored "-Wparentheses"
-#  endif
+# if __GNUC_PREREQ(4,2)
+#  pragma GCC diagnostic ignored "-Wparentheses"
 # endif
 
 /*Some assembly constructs require aligned operands.

Modified: trunk/theora/lib/mathops.h
===================================================================
--- trunk/theora/lib/mathops.h	2010-10-29 04:00:07 UTC (rev 17577)
+++ trunk/theora/lib/mathops.h	2010-10-29 04:21:26 UTC (rev 17578)
@@ -2,30 +2,28 @@
 # define _mathops_H (1)
 # include <ogg/ogg.h>
 
-# ifdef __GNUC_PREREQ
-#  if __GNUC_PREREQ(3,4)
-#   include <limits.h>
+# if __GNUC_PREREQ(3,4)
+#  include <limits.h>
 /*Note the casts to (int) below: this prevents OC_CLZ{32|64}_OFFS from
    "upgrading" the type of an entire expression to an (unsigned) size_t.*/
-#   if INT_MAX>=2147483647
-#    define OC_CLZ32_OFFS ((int)sizeof(unsigned)*CHAR_BIT)
-#    define OC_CLZ32(_x) (__builtin_clz(_x))
-#   elif LONG_MAX>=2147483647L
-#    define OC_CLZ32_OFFS ((int)sizeof(unsigned long)*CHAR_BIT)
-#    define OC_CLZ32(_x) (__builtin_clzl(_x))
-#   endif
-#   if INT_MAX>=9223372036854775807LL
-#    define OC_CLZ64_OFFS ((int)sizeof(unsigned)*CHAR_BIT)
-#    define OC_CLZ64(_x) (__builtin_clz(_x))
-#   elif LONG_MAX>=9223372036854775807LL
-#    define OC_CLZ64_OFFS ((int)sizeof(unsigned long)*CHAR_BIT)
-#    define OC_CLZ64(_x) (__builtin_clzl(_x))
-#   elif LLONG_MAX>=9223372036854775807LL|| \
-     __LONG_LONG_MAX__>=9223372036854775807LL
-#    define OC_CLZ64_OFFS ((int)sizeof(unsigned long long)*CHAR_BIT)
-#    define OC_CLZ64(_x) (__builtin_clzll(_x))
-#   endif
+#  if INT_MAX>=2147483647
+#   define OC_CLZ32_OFFS ((int)sizeof(unsigned)*CHAR_BIT)
+#   define OC_CLZ32(_x) (__builtin_clz(_x))
+#  elif LONG_MAX>=2147483647L
+#   define OC_CLZ32_OFFS ((int)sizeof(unsigned long)*CHAR_BIT)
+#   define OC_CLZ32(_x) (__builtin_clzl(_x))
 #  endif
+#  if INT_MAX>=9223372036854775807LL
+#   define OC_CLZ64_OFFS ((int)sizeof(unsigned)*CHAR_BIT)
+#   define OC_CLZ64(_x) (__builtin_clz(_x))
+#  elif LONG_MAX>=9223372036854775807LL
+#   define OC_CLZ64_OFFS ((int)sizeof(unsigned long)*CHAR_BIT)
+#   define OC_CLZ64(_x) (__builtin_clzl(_x))
+#  elif LLONG_MAX>=9223372036854775807LL|| \
+    __LONG_LONG_MAX__>=9223372036854775807LL
+#   define OC_CLZ64_OFFS ((int)sizeof(unsigned long long)*CHAR_BIT)
+#   define OC_CLZ64(_x) (__builtin_clzll(_x))
+#  endif
 # endif
 
 

Modified: trunk/theora/lib/x86/x86int.h
===================================================================
--- trunk/theora/lib/x86/x86int.h	2010-10-29 04:00:07 UTC (rev 17577)
+++ trunk/theora/lib/x86/x86int.h	2010-10-29 04:21:26 UTC (rev 17578)
@@ -59,11 +59,9 @@
 
 /*Memory operands do not always include an offset.
   To avoid warnings, we force an offset with %H (which adds 8).*/
-# if defined(__GNUC_PREREQ)
-#  if __GNUC_PREREQ(4,0)
-#   define OC_MEM_OFFS(_offs,_name) \
+# if __GNUC_PREREQ(4,0)
+#  define OC_MEM_OFFS(_offs,_name) \
   OC_M2STR(_offs-8+%H[_name])
-#  endif
 # endif
 /*If your gcc version does't support %H, then you get to suffer the warnings.
   Note that Apple's gas breaks on things like _offs+(%esp): it throws away the



More information about the commits mailing list