remove old inline cruft

fewer macros = better
This commit is contained in:
Enno Rehling 2014-03-15 14:51:57 -07:00
parent d4caf29d4f
commit 8e42cb8143
3 changed files with 4 additions and 18 deletions

View File

@ -58,13 +58,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# define _CRTDBG_MAP_ALLOC # define _CRTDBG_MAP_ALLOC
#endif #endif
# define HAVE_INLINE
# define INLINE_FUNCTION __inline
#endif /* _MSC_VER_ */ #endif /* _MSC_VER_ */
#if defined __GNUC__ #if defined __GNUC__
# define HAVE_INLINE
# define INLINE_FUNCTION static __inline
# undef _BSD_SOURCE # undef _BSD_SOURCE
# define _BSD_SOURCE # define _BSD_SOURCE
# undef __USE_BSD # undef __USE_BSD
@ -82,12 +78,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# define _XOPEN_SOURCE # define _XOPEN_SOURCE
#endif #endif
/* TinyCC */
#ifdef TINYCC
# undef HAVE_INLINE
# define INLINE_FUNCTION
#endif
/**** **** /**** ****
** min/max macros ** ** min/max macros **
**** ****/ **** ****/

View File

@ -29,15 +29,11 @@ extern "C" {
extern int *intlist_add(int *i_p, int i); extern int *intlist_add(int *i_p, int i);
extern int *intlist_find(int *i_p, int i); extern int *intlist_find(int *i_p, int i);
#ifdef HAVE_INLINE
# include "strings.c"
#else
extern unsigned int hashstring(const char *s); extern unsigned int hashstring(const char *s);
extern const char *escape_string(const char *str, char *buffer, extern const char *escape_string(const char *str, char *buffer,
unsigned int len); unsigned int len);
extern unsigned int jenkins_hash(unsigned int a); extern unsigned int jenkins_hash(unsigned int a);
extern unsigned int wang_hash(unsigned int a); extern unsigned int wang_hash(unsigned int a);
#endif
/* benchmark for units: /* benchmark for units:
* JENKINS_HASH: 5.25 misses/hit (with good cache behavior) * JENKINS_HASH: 5.25 misses/hit (with good cache behavior)

View File

@ -21,7 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* libc includes */ /* libc includes */
#include <string.h> #include <string.h>
INLINE_FUNCTION unsigned int hashstring(const char *s) unsigned int hashstring(const char *s)
{ {
unsigned int key = 0; unsigned int key = 0;
while (*s) { while (*s) {
@ -30,7 +30,7 @@ INLINE_FUNCTION unsigned int hashstring(const char *s)
return key & 0x7FFFFFFF; return key & 0x7FFFFFFF;
} }
INLINE_FUNCTION const char *escape_string(const char *str, char *buffer, const char *escape_string(const char *str, char *buffer,
unsigned int len) unsigned int len)
{ {
const char *start = strchr(str, '\"'); const char *start = strchr(str, '\"');
@ -69,7 +69,7 @@ INLINE_FUNCTION const char *escape_string(const char *str, char *buffer,
return str; return str;
} }
INLINE_FUNCTION unsigned int jenkins_hash(unsigned int a) unsigned int jenkins_hash(unsigned int a)
{ {
a = (a + 0x7ed55d16) + (a << 12); a = (a + 0x7ed55d16) + (a << 12);
a = (a ^ 0xc761c23c) ^ (a >> 19); a = (a ^ 0xc761c23c) ^ (a >> 19);
@ -80,7 +80,7 @@ INLINE_FUNCTION unsigned int jenkins_hash(unsigned int a)
return a; return a;
} }
INLINE_FUNCTION unsigned int wang_hash(unsigned int a) unsigned int wang_hash(unsigned int a)
{ {
a = ~a + (a << 15); /* a = (a << 15) - a - 1; */ a = ~a + (a << 15); /* a = (a << 15) - a - 1; */
a = a ^ (a >> 12); a = a ^ (a >> 12);