diff options
Diffstat (limited to 'src/util/integer_cln_imp.cpp')
-rw-r--r-- | src/util/integer_cln_imp.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/util/integer_cln_imp.cpp b/src/util/integer_cln_imp.cpp index b42334256..a4035165e 100644 --- a/src/util/integer_cln_imp.cpp +++ b/src/util/integer_cln_imp.cpp @@ -142,13 +142,19 @@ bool Integer::isBitSet(uint32_t i) const return !extractBitRange(1, i).isZero(); } -Integer Integer::setBit(uint32_t i, bool value) const +void Integer::setBit(uint32_t i, bool value) { cln::cl_I mask(1); mask = mask << i; - if (value) return Integer(cln::logior(d_value, mask)); - mask = cln::lognot(mask); - return Integer(cln::logand(d_value, mask)); + if (value) + { + d_value = cln::logior(d_value, mask); + } + else + { + mask = cln::lognot(mask); + d_value = cln::logand(d_value, mask); + } } Integer Integer::oneExtend(uint32_t size, uint32_t amount) const |