summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-03-17 09:06:26 +0000
committerBruno Haible <bruno@clisp.org>2003-03-17 09:06:26 +0000
commit40f37680ac107a61bbe14efe6213f70c91c6b461 (patch)
treede9745baf74fef6c7ca230d1eef0e79180674aa4
parent7a8b43182a9e171bbd307466dde6b5c7878135f4 (diff)
downloadgperf-40f37680ac107a61bbe14efe6213f70c91c6b461.tar.gz
Use 'unsigned int' instead of 'int' where it makes sense.
-rw-r--r--ChangeLog14
-rw-r--r--src/output.cc6
-rw-r--r--src/output.h4
-rw-r--r--src/search.cc10
-rw-r--r--src/search.h4
5 files changed, 26 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b6386c3..0d80f47 100644
--- a/ChangeLog
+++ b/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.
diff --git a/src/output.cc b/src/output.cc
index 03b7777..20ca0bf 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -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 (",");
diff --git a/src/output.h b/src/output.h
index d5bed74..d600547 100644
--- a/src/output.h
+++ b/src/output.h
@@ -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. */
diff --git a/src/search.cc b/src/search.cc
index 0046c55..705827e 100644
--- a/src/search.cc
+++ b/src/search.cc
@@ -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]);
diff --git a/src/search.h b/src/search.h
index 928c615..2ff3f78 100644
--- a/src/search.h
+++ b/src/search.h
@@ -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;