aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/math/bigint/big_ops2.cpp2
-rw-r--r--src/lib/utils/ct_utils.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/math/bigint/big_ops2.cpp b/src/lib/math/bigint/big_ops2.cpp
index 5352ac04e..df672d035 100644
--- a/src/lib/math/bigint/big_ops2.cpp
+++ b/src/lib/math/bigint/big_ops2.cpp
@@ -380,7 +380,7 @@ BigInt& BigInt::operator>>=(size_t shift)
const size_t sw = sig_words();
bigint_shr1(m_data.mutable_data(), sw, shift_words, shift_bits);
- if(is_zero())
+ if(is_negative() && is_zero())
set_sign(Positive);
}
diff --git a/src/lib/utils/ct_utils.h b/src/lib/utils/ct_utils.h
index 0303d2a6c..63b8f4640 100644
--- a/src/lib/utils/ct_utils.h
+++ b/src/lib/utils/ct_utils.h
@@ -110,7 +110,8 @@ template<typename T>
inline constexpr T select(T mask, T from0, T from1)
{
static_assert(std::is_unsigned<T>::value, "unsigned integer type required");
- return static_cast<T>((from0 & mask) | (from1 & ~mask));
+ //return static_cast<T>((from0 & mask) | (from1 & ~mask));
+ return static_cast<T>(from1 ^ (mask & (from0 ^ from1)));
}
template<typename T>