/* 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
/*
* 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.