diff options
author | Shawn Routhier <sar@isc.org> | 2010-02-02 00:44:06 +0000 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2010-02-02 00:44:06 +0000 |
commit | a35285748d900c9bc65cf57f99bdc548e626171e (patch) | |
tree | a9dda4dfb2a8a75f2f13f75e9244461c643b5ba1 /omapip/hash.c | |
parent | 3c941d426df34fdfee70643eb91a360f2e7b22c2 (diff) | |
download | isc-dhcp-a35285748d900c9bc65cf57f99bdc548e626171e.tar.gz |
Clean up some compiler warnings
Diffstat (limited to 'omapip/hash.c')
-rw-r--r-- | omapip/hash.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/omapip/hash.c b/omapip/hash.c index bace3cd4..e33f803e 100644 --- a/omapip/hash.c +++ b/omapip/hash.c @@ -297,23 +297,27 @@ do_id_hash(const void *name, unsigned len, unsigned size) if (len == 0) return 0; - /* The switch indexes our starting position into the do/while loop, - * taking up the remainder after hashing in all the other bytes in - * threes. + /* + * The switch handles our starting conditions, then we hash the + * remaining bytes in groups of 3 */ + switch (len % 3) { - do { - case 0: - accum ^= *s++ << 16; - case 2: - accum ^= *s++ << 8; - case 1: - accum ^= *s++; - } while (s < end); - + case 0: + break; + case 2: + accum ^= *s++ << 8; + case 1: + accum ^= *s++; break; } + while (s < end) { + accum ^= *s++ << 16; + accum ^= *s++ << 8; + accum ^= *s++; + } + return accum % size; } |