From 20115137eeb54b6310f4c92f8fdb482eb5843af7 Mon Sep 17 00:00:00 2001 From: "julian.speith" Date: Mon, 1 Jul 2024 13:36:42 +0200 Subject: [PATCH] fixed loop stopping one iteration too early --- plugins/hawkeye/src/sbox_database.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/hawkeye/src/sbox_database.cpp b/plugins/hawkeye/src/sbox_database.cpp index d264230dfa3..1199f565d17 100644 --- a/plugins/hawkeye/src/sbox_database.cpp +++ b/plugins/hawkeye/src/sbox_database.cpp @@ -84,7 +84,9 @@ bool smallset_t::empty() const for (int i = 0; i < 4; i++) { if (dw64[i]) + { return false; + } } return true; } @@ -94,7 +96,9 @@ u8 smallset_t::least_bit() const for (int i = 0; i < 4; i++) { if (dw64[i]) + { return i * 64 + least_bit(dw64[i]); + } } std::cerr << "Called smallset_t::least_bit() on empty set\n" << std::endl; return 0; @@ -166,8 +170,10 @@ smallset_t smallset_t::shuffle(u8 shift) const void smallset_t::to_array(u64* arr) const { - for (int i=0; i<3; i++) - arr[i] = dw64[3-i]; + for (int i = 0; i < 4; i++) + { + arr[i] = dw64[3 - i]; + } } void smallset_t::set(u8 bit)