remove statement expressions - they are not faster
Costa Tsaousis (ktsaou) committed
Jan 19, 2017 at 22:56 UTC
1ffb89de743b8c691fc480b487717f49edf446f7
2 files changed
+3
-31
configure.ac
+1
-1
@@ -129,7 +129,7 @@ AC_C_INLINE
129
AC_FUNC_STRERROR_R
130
AC_C__GENERIC
131
AC_C___ATOMIC
132
-AC_C_STMT_EXPR
132
+# AC_C_STMT_EXPR
133
AC_CHECK_SIZEOF([void *])
134
AC_CANONICAL_HOST
135
AC_HEADER_MAJOR
src/inlined.h
+2
-30
@@ -3,35 +3,9 @@
3
4
#include "common.h"
5
6
-#ifdef HAVE_STMT_EXPR_NON_EXISTING
7
-// GCC extension to define a function as a preprocessor macro
8
-
9
-#define simple_hash(name) ({ \
10
- register unsigned char *__hash_source = (unsigned char *)(name); \
11
- register uint32_t __hash_value = 0x811c9dc5; \
12
- while (*__hash_source) { \
13
- __hash_value *= 16777619; \
14
- __hash_value ^= (uint32_t) *__hash_source++; \
15
- } \
16
- __hash_value; \
17
-})
18
-
19
-#define simple_uhash(name) ({ \
20
- register unsigned char *__hash_source = (unsigned char *)(name); \
21
- register uint32_t __hash_value = 0x811c9dc5, __hash_char; \
22
- while ((__hash_char = *__hash_source++)) { \
23
- if (unlikely(__hash_char >= 'A' && __hash_char <= 'Z')) \
24
- __hash_char += 'a' - 'A'; \
25
- __hash_value *= 16777619; \
26
- __hash_value ^= __hash_char; \
27
- } \
28
- __hash_value; \
29
-})
30
-
31
-#else /* ! HAVE_STMT_EXPR */
32
-
6
// for faster execution, allow the compiler to inline
34
-// these functions that are called to hash strings
7
+// these functions that are called thousands of times per second
8
+
9
static inline uint32_t simple_hash(const char *name) {
10
register unsigned char *s = (unsigned char *) name;
11
register uint32_t hval = 0x811c9dc5;
@@ -53,8 +27,6 @@ static inline uint32_t simple_uhash(const char *name) {
27
return hval;
28
}
29
56
-#endif /* HAVE_STMT_EXPR */
57
-
30
static inline int str2i(const char *s) {
31
register int n = 0;
32
register char c, negative = (*s == '-');