]> arthur.barton.de Git - netdata.git/commitdiff
remove statement expressions - they are not faster
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 19 Jan 2017 20:56:24 +0000 (22:56 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 19 Jan 2017 20:56:24 +0000 (22:56 +0200)
configure.ac
src/inlined.h

index 002a3aa599acd58d83fcb8c0ee407860d03159ac..2d01ac8a818346f4a508573cbf9ee1d369dd11f6 100644 (file)
@@ -129,7 +129,7 @@ AC_C_INLINE
 AC_FUNC_STRERROR_R
 AC_C__GENERIC
 AC_C___ATOMIC
-AC_C_STMT_EXPR
+AC_C_STMT_EXPR
 AC_CHECK_SIZEOF([void *])
 AC_CANONICAL_HOST
 AC_HEADER_MAJOR
index a18564f58d43ed41d0af73be79c4baaa3e794b1c..7a3e4bb0fb30de2543e43925e845a98ffa5c7c3a 100644 (file)
@@ -3,35 +3,9 @@
 
 #include "common.h"
 
-#ifdef HAVE_STMT_EXPR_NON_EXISTING
-// GCC extension to define a function as a preprocessor macro
-
-#define simple_hash(name) ({                                         \
-    register unsigned char *__hash_source = (unsigned char *)(name); \
-    register uint32_t __hash_value = 0x811c9dc5;                     \
-    while (*__hash_source) {                                         \
-        __hash_value *= 16777619;                                    \
-        __hash_value ^= (uint32_t) *__hash_source++;                 \
-    }                                                                \
-    __hash_value;                                                    \
-})
-
-#define simple_uhash(name) ({                                        \
-    register unsigned char *__hash_source = (unsigned char *)(name); \
-    register uint32_t __hash_value = 0x811c9dc5, __hash_char;        \
-    while ((__hash_char = *__hash_source++)) {                       \
-        if (unlikely(__hash_char >= 'A' && __hash_char <= 'Z'))      \
-            __hash_char += 'a' - 'A';                                \
-        __hash_value *= 16777619;                                    \
-        __hash_value ^= __hash_char;                                 \
-    }                                                                \
-    __hash_value;                                                    \
-})
-
-#else /* ! HAVE_STMT_EXPR */
-
 // for faster execution, allow the compiler to inline
-// these functions that are called to hash strings
+// these functions that are called thousands of times per second
+
 static inline uint32_t simple_hash(const char *name) {
     register unsigned char *s = (unsigned char *) name;
     register uint32_t hval = 0x811c9dc5;
@@ -53,8 +27,6 @@ static inline uint32_t simple_uhash(const char *name) {
     return hval;
 }
 
-#endif /* HAVE_STMT_EXPR */
-
 static inline int str2i(const char *s) {
     register int n = 0;
     register char c, negative = (*s == '-');