summaryrefslogtreecommitdiff
path: root/reclaim.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-06-14 02:20:34 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-06-14 02:20:34 +0300
commit962eea47ca5bb2c9fc1043557cbc6c894e64940d (patch)
tree6567d7e75756ff52c26f44a8235031168a5b461b /reclaim.c
parentc16ba4105a4c0a23490645f61beb4922c47fc1bd (diff)
downloadbdwgc-962eea47ca5bb2c9fc1043557cbc6c894e64940d.tar.gz
Remove unnecessary type casts in n_set_marks
(code refactoring) * reclaim.c (GC_n_set_marks): Change return type from int to unsigned; change type of result local variable to unsigned. * reclaim.c [!USE_MARK_BYTES] (set_bits): Likewise. * reclaim.c (GC_n_set_marks): Change type of i, offset, limit, n_mark_words, n_objs local variables to word; remove redundant casts.
Diffstat (limited to 'reclaim.c')
-rw-r--r--reclaim.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/reclaim.c b/reclaim.c
index 3c3583e1..90bf29a7 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -486,13 +486,13 @@ struct Print_stats
/* Return the number of set mark bits in the given header. */
/* Remains externally visible as used by GNU GCJ currently. */
-int GC_n_set_marks(hdr *hhdr)
+unsigned GC_n_set_marks(hdr *hhdr)
{
- int result = 0;
- int i;
+ unsigned result = 0;
+ word i;
word sz = hhdr -> hb_sz;
- int offset = (int)MARK_BIT_OFFSET(sz);
- int limit = (int)FINAL_MARK_BIT(sz);
+ word offset = MARK_BIT_OFFSET(sz);
+ word limit = FINAL_MARK_BIT(sz);
for (i = 0; i < limit; i += offset) {
result += hhdr -> hb_marks[i];
@@ -504,10 +504,10 @@ int GC_n_set_marks(hdr *hhdr)
#else
/* Number of set bits in a word. Not performance critical. */
-static int set_bits(word n)
+static unsigned set_bits(word n)
{
word m = n;
- int result = 0;
+ unsigned result = 0;
while (m > 0) {
if (m & 1) result++;
@@ -516,13 +516,13 @@ static int set_bits(word n)
return(result);
}
-int GC_n_set_marks(hdr *hhdr)
+unsigned GC_n_set_marks(hdr *hhdr)
{
- int result = 0;
- int i;
- int n_mark_words;
+ unsigned result = 0;
+ word i;
+ word n_mark_words;
# ifdef MARK_BIT_PER_OBJ
- int n_objs = (int)HBLK_OBJS(hhdr -> hb_sz);
+ word n_objs = HBLK_OBJS(hhdr -> hb_sz);
if (0 == n_objs) n_objs = 1;
n_mark_words = divWORDSZ(n_objs + WORDSZ - 1);