Skip to content
Snippets Groups Projects
Commit bc60f8b3 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

making sure __GNUC_PREREQ() is only used when __GNUC__ is defined

parent 07586892
No related branches found
No related tags found
No related merge requests found
...@@ -47,9 +47,12 @@ ...@@ -47,9 +47,12 @@
_b: The value to clamp. _b: The value to clamp.
_c: The upper boud.*/ _c: The upper boud.*/
#define EC_CLAMPI(_a,_b,_c) (EC_MAXI(_a,EC_MINI(_b,_c))) #define EC_CLAMPI(_a,_b,_c) (EC_MAXI(_a,EC_MINI(_b,_c)))
/*Count leading zeros. /*Count leading zeros.
This macro should only be used for implementing ec_ilog(), if it is defined. This macro should only be used for implementing ec_ilog(), if it is defined.
All other code should use EC_ILOG() instead.*/ All other code should use EC_ILOG() instead.*/
#ifdef __GNUC__
#if __GNUC_PREREQ(3,4) #if __GNUC_PREREQ(3,4)
# if INT_MAX>=2147483647 # if INT_MAX>=2147483647
# define EC_CLZ0 sizeof(unsigned)*CHAR_BIT # define EC_CLZ0 sizeof(unsigned)*CHAR_BIT
...@@ -59,6 +62,8 @@ ...@@ -59,6 +62,8 @@
# define EC_CLZ(_x) (__builtin_clzl(_x)) # define EC_CLZ(_x) (__builtin_clzl(_x))
# endif # endif
#endif #endif
#endif
#if defined(EC_CLZ) #if defined(EC_CLZ)
/*Note that __builtin_clz is not defined when _x==0, according to the gcc /*Note that __builtin_clz is not defined when _x==0, according to the gcc
documentation (and that of the BSR instruction that implements it on x86). documentation (and that of the BSR instruction that implements it on x86).
...@@ -68,6 +73,8 @@ ...@@ -68,6 +73,8 @@
#else #else
# define EC_ILOG(_x) (ec_ilog(_x)) # define EC_ILOG(_x) (ec_ilog(_x))
#endif #endif
#ifdef __GNUC__
#if __GNUC_PREREQ(3,4) #if __GNUC_PREREQ(3,4)
# if INT_MAX>=9223372036854775807 # if INT_MAX>=9223372036854775807
# define EC_CLZ64_0 sizeof(unsigned)*CHAR_BIT # define EC_CLZ64_0 sizeof(unsigned)*CHAR_BIT
...@@ -80,6 +87,8 @@ ...@@ -80,6 +87,8 @@
# define EC_CLZ64(_x) (__builtin_clzll(_x)) # define EC_CLZ64(_x) (__builtin_clzll(_x))
# endif # endif
#endif #endif
#endif
#if defined(EC_CLZ64) #if defined(EC_CLZ64)
/*Note that __builtin_clz is not defined when _x==0, according to the gcc /*Note that __builtin_clz is not defined when _x==0, according to the gcc
documentation (and that of the BSR instruction that implements it on x86). documentation (and that of the BSR instruction that implements it on x86).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment