1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 02:36:16 +02:00

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.
This commit is contained in:
Paul Eggert
2010-07-06 16:16:20 -07:00
parent fb1a26c3f6
commit db4df7dda6
2 changed files with 2 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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;
}