mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Don't include the length in the hash function if all keywords have the same
length.
This commit is contained in:
@@ -37,8 +37,8 @@ error "gperf generated tables don't work with this execution character set. Plea
|
||||
#define TOTAL_KEYWORDS 8
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 2
|
||||
#define MIN_HASH_VALUE 2
|
||||
#define MAX_HASH_VALUE 9
|
||||
#define MIN_HASH_VALUE 0
|
||||
#define MAX_HASH_VALUE 7
|
||||
/* maximum key range = 8, duplicates = 0 */
|
||||
|
||||
#ifndef GPERF_DOWNCASE
|
||||
@@ -91,6 +91,7 @@ __inline
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
/*ARGSUSED*/
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
@@ -98,34 +99,34 @@ hash (str, len)
|
||||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10, 1,10,10, 3,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10, 3, 1,
|
||||
0, 7, 1, 0, 3,10,10, 1,10,10,
|
||||
3,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
3, 1, 0, 0, 1, 0, 2,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10,10,
|
||||
10,10,10,10,10,10,10,10,10
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 1, 8, 8, 3, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 3, 1,
|
||||
0, 7, 1, 0, 3, 8, 8, 1, 8, 8,
|
||||
3, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
3, 1, 0, 0, 1, 0, 2, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[1]+3] + asso_values[(unsigned char)str[0]];
|
||||
return asso_values[(unsigned char)str[1]+3] + asso_values[(unsigned char)str[0]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -141,7 +142,6 @@ in_word_set (str, len)
|
||||
{
|
||||
static const char * wordlist[] =
|
||||
{
|
||||
"", "",
|
||||
"{w",
|
||||
"az",
|
||||
"ay",
|
||||
|
||||
Reference in New Issue
Block a user