From: Robert Spalek Date: Sat, 1 Jun 2002 09:57:07 +0000 (+0000) Subject: after a long time of experimenting, added a support for unaligned parameters X-Git-Tag: holmes-import~1412 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=d3fcf8f71a35ff0c191fb07e1f9ffe3d2eec3041;p=libucw.git after a long time of experimenting, added a support for unaligned parameters --- diff --git a/lib/str_hash.c b/lib/str_hash.c index 44310158..5b05db66 100644 --- a/lib/str_hash.c +++ b/lib/str_hash.c @@ -11,8 +11,8 @@ #include "lib/lib.h" #include "lib/str_hash.h" -/* The number of bits the hash (in the function str_hash()) is rotated after - * every pass by. It should be prime with the word size. */ +/* The number of bits the hash in the function str_hash() is rotated by after + * every pass. It should be prime with the word size. */ #define SHIFT_BITS 5 /* A bit-mask which clears higher bytes than a given threshold. */ @@ -25,7 +25,7 @@ str_hash_init(void) char *str; for (i=0; i> (sizeof(uns)*8 - (bits)))) +/* The following functions need str to be aligned to uns. */ +uns str_len_aligned(const char *str) __attribute__((const)); +uns str_hash_aligned(const char *str) __attribute__((const)); + +#ifdef CPU_ALLOW_UNALIGNED +#define str_len(str) str_len_aligned(str) +#define str_hash(str) str_hash_aligned(str) +#else uns str_len(const char *str) __attribute__((const)); uns str_hash(const char *str) __attribute__((const)); +#endif