diff options
author | mav <mav@FreeBSD.org> | 2008-01-27 02:04:12 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-01-27 02:04:12 +0000 |
commit | 34b15a0c5e4c3bfd1d0b3aecbfda69fd7453eb7d (patch) | |
tree | a6a6a1bd7b78544cd3b4c7034441d9cbc4658946 /sys/netgraph/ng_pred1.c | |
parent | 7851cf479d89eb794936da877a8b2c904c80a5cd (diff) | |
download | FreeBSD-src-34b15a0c5e4c3bfd1d0b3aecbfda69fd7453eb7d.zip FreeBSD-src-34b15a0c5e4c3bfd1d0b3aecbfda69fd7453eb7d.tar.gz |
Slightly simplify code.
Diffstat (limited to 'sys/netgraph/ng_pred1.c')
-rw-r--r-- | sys/netgraph/ng_pred1.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netgraph/ng_pred1.c b/sys/netgraph/ng_pred1.c index e637a9d..981448e 100644 --- a/sys/netgraph/ng_pred1.c +++ b/sys/netgraph/ng_pred1.c @@ -565,7 +565,7 @@ static int Pred1Compress(node_p node, u_char *source, u_char *dest, int len) { const priv_p priv = NG_NODE_PRIVATE(node); - int i, bitmask; + int i; u_char flags; u_char *flagdest, *orgdest; @@ -573,10 +573,10 @@ Pred1Compress(node_p node, u_char *source, u_char *dest, int len) while (len) { flagdest = dest++; flags = 0; /* All guesses are wrong initially. */ - for (bitmask = 1, i = 0; i < 8 && len; i++, bitmask <<= 1) { + for (i = 0; i < 8 && len; i++) { if (priv->GuessTable[priv->Hash] == *source) /* Guess was right - don't output. */ - flags |= bitmask; + flags |= (1 << i); else { /* Guess wrong, output char. */ priv->GuessTable[priv->Hash] = *source; @@ -600,17 +600,17 @@ static int Pred1Decompress(node_p node, u_char *source, u_char *dest, int slen, int dlen) { const priv_p priv = NG_NODE_PRIVATE(node); - int i, bitmask; + int i; u_char flags, *orgdest; orgdest = dest; while (slen) { flags = *source++; slen--; - for (i = 0, bitmask = 1; i < 8; i++, bitmask <<= 1) { + for (i = 0; i < 8; i++, flags >>= 1) { if (dlen <= 0) return(-1); - if (flags & bitmask) + if (flags & 0x01) /* Guess correct */ *dest = priv->GuessTable[priv->Hash]; else { |