diff options
author | Bruno Haible <bruno@clisp.org> | 2016-11-26 02:21:19 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2016-11-26 02:25:44 +0100 |
commit | bbe4d732f3540e2917d35d5ae49ba42869eebb3b (patch) | |
tree | 202f2d0583ad5c0505d058e203b448677749d7e7 /src/output.cc | |
parent | b3356507ce8a6e2636fcc22abb7965989f7f4d07 (diff) | |
download | gperf-bbe4d732f3540e2917d35d5ae49ba42869eebb3b.tar.gz |
Avoid 'warning: implicit conversion changes signedness' in output code.
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/output.cc b/src/output.cc index d01687c..e60f8f7 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1615,7 +1615,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const { printf (" if (len <= %sMAX_WORD_LENGTH && len >= %sMIN_WORD_LENGTH)\n" " {\n" - " register int key = %s (str, len);\n\n", + " register unsigned int key = %s (str, len);\n\n", option.get_constants_prefix (), option.get_constants_prefix (), option.get_hash_name ()); @@ -1626,9 +1626,13 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const if (num_switches > switch_size) num_switches = switch_size; - printf (" if (key <= %sMAX_HASH_VALUE && key >= %sMIN_HASH_VALUE)\n" - " {\n", - option.get_constants_prefix (), option.get_constants_prefix ()); + printf (" if (key <= %sMAX_HASH_VALUE", + option.get_constants_prefix ()); + if (_min_hash_value > 0) + printf (" && key >= %sMIN_HASH_VALUE", + option.get_constants_prefix ()); + printf (")\n" + " {\n"); if (option[DUP] && _total_duplicates > 0) { if (option[LENTABLE]) @@ -1726,7 +1730,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const } else { - printf (" if (key <= %sMAX_HASH_VALUE && key >= 0)\n", + printf (" if (key <= %sMAX_HASH_VALUE)\n", option.get_constants_prefix ()); if (option[DUP]) |