From 55457923d0b834136da34d2bad06c3a23a7e3043 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 26 Dec 2018 22:35:04 +0100 Subject: [PATCH] =?UTF-8?q?Stopped=20counting=20the=20bits=20from=20the=20?= =?UTF-8?q?wrong=20side.=20=F0=9F=A4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/identiconpp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/identiconpp.cpp b/src/identiconpp.cpp index dcf8219..9d41c16 100644 --- a/src/identiconpp.cpp +++ b/src/identiconpp.cpp @@ -69,10 +69,11 @@ bool Identiconpp::get_bit(const uint16_t bit, const string &digest) ss >> buf; std::bitset<4> nibble(buf); - if (nibble[bit % 4]) + if (nibble[3 - bit % 4]) { - ttdebug << "Bit " << std::to_string(bit) << " is set in " + ttdebug << "Bit " << std::to_string(bit + 1) << " is set in " << digest << ".\n"; + ttdebug << nibble << " (" << bit % 4 << ")\n"; return true; }