]> mj.ucw.cz Git - libucw.git/commitdiff
Compatibility with GCC < 4.0 is not needed any longer
authorMartin Mares <mj@ucw.cz>
Sun, 6 May 2018 08:55:53 +0000 (10:55 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 6 May 2018 08:55:53 +0000 (10:55 +0200)
ucw/bitops.h
ucw/lib.h

index 0991de34f1dfe0756d3dbf49c0c804bbdc541229..21f40c47fc140a8c9e34a3b69665dc51baf29cce 100644 (file)
@@ -45,26 +45,9 @@ static inline uint bit_ffs(uint w)
 
 /* Count the number of bits set */
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-
 static inline uint bit_count(uint w)
 {
   return __builtin_popcount(w);
 }
 
-#else
-
-static inline uint bit_count(uint w)
-{
-  uint n = 0;
-  while (w)
-    {
-      w &= w - 1;
-      n++;
-    }
-  return n;
-}
-
-#endif
-
 #endif
index 5df7d6e1450d2df93cb1a17331941fd6da5fedc4..5ce751e9789718da42fc9d22f865ed302618bdfa 100644 (file)
--- a/ucw/lib.h
+++ b/ucw/lib.h
@@ -1,7 +1,7 @@
 /*
  *     The UCW Library -- Miscellaneous Functions
  *
- *     (c) 1997--2014 Martin Mares <mj@ucw.cz>
+ *     (c) 1997--2018 Martin Mares <mj@ucw.cz>
  *     (c) 2005--2014 Tomas Valla <tom@ucw.cz>
  *     (c) 2006 Robert Spalek <robert@ucw.cz>
  *     (c) 2007 Pavel Charvat <pchar@ucw.cz>
 #define FORMAT_CHECK(x,y,z) __attribute__((format(x,y,z)))             /** Checking of printf-like format strings **/
 #define likely(x) __builtin_expect((x),1)                              /** Use `if (likely(@x))` if @x is almost always true **/
 #define unlikely(x) __builtin_expect((x),0)                            /** Use `if (unlikely(@x))` to hint that @x is almost always false **/
-
-#if __GNUC__ >= 4 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3
 #define ALWAYS_INLINE inline __attribute__((always_inline))            /** Forcibly inline **/
 #define NO_INLINE __attribute__((noinline))                            /** Forcibly uninline **/
-#else
-#define ALWAYS_INLINE inline
-#endif
-
-#if __GNUC__ >= 4
 #define LIKE_MALLOC __attribute__((malloc))                            /** Function returns a "new" pointer **/
 #define SENTINEL_CHECK __attribute__((sentinel))                       /** The last argument must be NULL **/
-#else
-#define LIKE_MALLOC
-#define SENTINEL_CHECK
-#endif
 
 #else
 #error This program requires the GNU C compiler.