aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/lc-btrie/btrie.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/lc-btrie/btrie.c b/contrib/lc-btrie/btrie.c
index b1c66f1c3..8b598b09b 100644
--- a/contrib/lc-btrie/btrie.c
+++ b/contrib/lc-btrie/btrie.c
@@ -658,7 +658,8 @@ static inline int prefixes_equal(const btrie_oct_t *pfx1,
const btrie_oct_t *pfx2, unsigned len)
{
return (memcmp (pfx1, pfx2, len / 8) == 0
- && ((pfx1[len / 8] ^ pfx2[len / 8]) & high_bits (len % 8)) == 0);
+ && (len % 8 == 0 ||
+ ((pfx1[len / 8] ^ pfx2[len / 8]) & high_bits (len % 8)) == 0));
}
/* determine length of longest common subprefix */