From 284b47a69ac4fc23b4d245bf4d77297b109c8c93 Mon Sep 17 00:00:00 2001 From: "Alexander G. Pronchenkov" Date: Tue, 26 Jan 2010 16:35:42 +0500 Subject: [PATCH] Fixed integer overflow in method bin64_t::to(). Symptom: ALL.left() == ALL.right() == ALL --- bin64.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin64.h b/bin64.h index 9045fe7..3550f22 100644 --- a/bin64.h +++ b/bin64.h @@ -93,10 +93,10 @@ struct bin64_t { bin64_t to (bool right) const { if (!(v&1)) return NONE; - uint64_t tb = tail_bit()>>1; + uint64_t tb = ((tail_bits() >> 1) + 1) >> 1; if (right) - tb |= (tb<<1); - return bin64_t(v^tb); + return bin64_t(v + tb); + return bin64_t(v ^ tb); } /** Get the left child bin. */ -- 2.20.1