mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Use 'unsigned int' instead of 'int' where it makes sense.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
||||
2002-12-08 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
* src/search.h (Search::_alpha_size): Change type to 'unsigned int'.
|
||||
(Search::_asso_value_max): Likewise.
|
||||
* src/search.cc (Search::prepare_asso_values): Update.
|
||||
(Search::init_asso_values): Update.
|
||||
(Search::~Search): Update.
|
||||
* src/output.h (Output::Output): Change alpha_size type to
|
||||
'unsigned int'.
|
||||
(Output::_alpha_size): Change type to 'unsigned int'.
|
||||
* src/output.cc (Output::Output): Change alpha_size type to
|
||||
'unsigned int'.
|
||||
(Output::output_hash_function): Update.
|
||||
|
||||
2002-12-07 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
* src/options.h (OPT_CHOICE): New enum value.
|
||||
|
||||
@@ -88,8 +88,8 @@ Output::Output (KeywordExt_List *head, const char *struct_decl,
|
||||
unsigned int verbatim_code_lineno,
|
||||
int total_keys, int max_key_len, int min_key_len,
|
||||
const Positions& positions, const unsigned int *alpha_inc,
|
||||
int total_duplicates, int alpha_size, const int *occurrences,
|
||||
const int *asso_values)
|
||||
int total_duplicates, unsigned int alpha_size,
|
||||
const int *occurrences, const int *asso_values)
|
||||
: _head (head), _struct_decl (struct_decl),
|
||||
_struct_decl_lineno (struct_decl_lineno), _return_type (return_type),
|
||||
_struct_tag (struct_tag),
|
||||
@@ -486,7 +486,7 @@ Output::output_hash_function () const
|
||||
for (int trunc = _max_hash_value; (trunc /= 10) > 0;)
|
||||
field_width++;
|
||||
|
||||
for (int count = 0; count < _alpha_size; count++)
|
||||
for (unsigned int count = 0; count < _alpha_size; count++)
|
||||
{
|
||||
if (count > 0)
|
||||
printf (",");
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
const Positions& positions,
|
||||
const unsigned int *alpha_inc,
|
||||
int total_duplicates,
|
||||
int alpha_size,
|
||||
unsigned int alpha_size,
|
||||
const int *occurrences,
|
||||
const int *asso_values);
|
||||
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
/* Maximum hash value for all keywords. */
|
||||
int _max_hash_value;
|
||||
/* Size of alphabet. */
|
||||
int const _alpha_size;
|
||||
unsigned int const _alpha_size;
|
||||
/* Counts occurrences of each key set character. */
|
||||
const int * const _occurrences;
|
||||
/* Value associated with each character. */
|
||||
|
||||
@@ -804,10 +804,10 @@ void
|
||||
Search::prepare_asso_values ()
|
||||
{
|
||||
int non_linked_length = keyword_list_length ();
|
||||
int asso_value_max;
|
||||
unsigned int asso_value_max;
|
||||
|
||||
asso_value_max =
|
||||
static_cast<int>(non_linked_length * option.get_size_multiple());
|
||||
static_cast<unsigned int>(non_linked_length * option.get_size_multiple());
|
||||
/* Round up to the next power of two. This makes it easy to ensure
|
||||
an _asso_value[c] is >= 0 and < asso_value_max. Also, the jump value
|
||||
being odd, it guarantees that Search::try_asso_value() will iterate
|
||||
@@ -880,7 +880,7 @@ Search::init_asso_values ()
|
||||
{
|
||||
if (_initial_asso_value < 0)
|
||||
{
|
||||
for (int i = 0; i < _alpha_size; i++)
|
||||
for (unsigned int i = 0; i < _alpha_size; i++)
|
||||
_asso_values[i] = rand () & (_asso_value_max - 1);
|
||||
}
|
||||
else
|
||||
@@ -888,7 +888,7 @@ Search::init_asso_values ()
|
||||
int asso_value = _initial_asso_value;
|
||||
|
||||
asso_value = asso_value & (_asso_value_max - 1);
|
||||
for (int i = 0; i < _alpha_size; i++)
|
||||
for (unsigned int i = 0; i < _alpha_size; i++)
|
||||
_asso_values[i] = asso_value;
|
||||
}
|
||||
}
|
||||
@@ -1534,7 +1534,7 @@ Search::~Search ()
|
||||
{
|
||||
fprintf (stderr, "\ndumping occurrence and associated values tables\n");
|
||||
|
||||
for (int i = 0; i < _alpha_size; i++)
|
||||
for (unsigned int i = 0; i < _alpha_size; i++)
|
||||
if (_occurrences[i])
|
||||
fprintf (stderr, "asso_values[%c] = %6d, occurrences[%c] = %6d\n",
|
||||
i, _asso_values[i], i, _occurrences[i]);
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
int _total_duplicates;
|
||||
|
||||
/* Size of alphabet. */
|
||||
int _alpha_size;
|
||||
unsigned int _alpha_size;
|
||||
|
||||
/* Counts occurrences of each key set character.
|
||||
_occurrences[c] is the number of times that c occurs among the _selchars
|
||||
@@ -156,7 +156,7 @@ private:
|
||||
bool * _determined;
|
||||
|
||||
/* Exclusive upper bound for every _asso_values[c]. A power of 2. */
|
||||
int _asso_value_max;
|
||||
unsigned int _asso_value_max;
|
||||
|
||||
/* Initial value for asso_values table. -1 means random. */
|
||||
int _initial_asso_value;
|
||||
|
||||
Reference in New Issue
Block a user