summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-07-06 16:16:20 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-07-06 16:16:50 -0700
commitdb4df7dda6e209e3e38fe69298624ffe92d392c7 (patch)
treeef0d7b1ccce398ef03bc9b572e67bf9c9d8105a0
parentfb1a26c3f64669a1b61740252c5db5fd5413c7e5 (diff)
downloadcoreutils-db4df7dda6e209e3e38fe69298624ffe92d392c7.tar.xz
du: avoid spurious warnings with 64-bit gcc -W
Problem reported by Jim Meyering in: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6524#74 * gl/lib/di-set.c (di_ent_hash): Rework so that the compiler does not incorrectly warn about shifting by 64-bits in unreachable code. * gl/lib/ino-map.c (ino_hash): Likewise.
-rw-r--r--gl/lib/di-set.c2
-rw-r--r--gl/lib/ino-map.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/gl/lib/di-set.c b/gl/lib/di-set.c
index e0e2b24dd..ba44bcfff 100644
--- a/gl/lib/di-set.c
+++ b/gl/lib/di-set.c
@@ -83,7 +83,7 @@ di_ent_hash (void const *x, size_t table_size)
size_t h = dev;
int i;
for (i = 1; i < sizeof dev / sizeof h + (sizeof dev % sizeof h != 0); i++)
- h ^= dev >>= CHAR_BIT * sizeof h;
+ h ^= dev >> CHAR_BIT * sizeof h * i;
return h % table_size;
}
diff --git a/gl/lib/ino-map.c b/gl/lib/ino-map.c
index c86898365..cc9a131c9 100644
--- a/gl/lib/ino-map.c
+++ b/gl/lib/ino-map.c
@@ -61,7 +61,7 @@ ino_hash (void const *x, size_t table_size)
size_t h = ino;
int i;
for (i = 1; i < sizeof ino / sizeof h + (sizeof ino % sizeof h != 0); i++)
- h ^= ino >>= CHAR_BIT * sizeof h;
+ h ^= ino >> CHAR_BIT * sizeof h * i;
return h % table_size;
}