summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCrypto
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2022-01-17 20:03:51 -0500
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-01-18 20:04:06 +0330
commitd9b6eb29bcd3228c3d5c14a83821293c52d199fa (patch)
tree6ee4519ba08fc7e187dba5488ffbadd7d016a3d0 /Userland/Libraries/LibCrypto
parent013799a4dd303653aead72f1b35c6d96767abc94 (diff)
downloadserenity-d9b6eb29bcd3228c3d5c14a83821293c52d199fa.zip
LibCrypto+LibJS: Better bitwise binary_xor binop
We went through some trouble to make & and | work right. Reimplement ^ in terms of & and | to make ^ work right as well. This is less fast than a direct implementation, but let's get things working first.
Diffstat (limited to 'Userland/Libraries/LibCrypto')
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
index 3d52592a6e..084f55e8c1 100644
--- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
+++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
@@ -238,12 +238,7 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(const SignedBigInteger& o
FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(const SignedBigInteger& other) const
{
- auto result = bitwise_xor(other.unsigned_value());
-
- // The sign bit will have to be XOR'd manually.
- result.m_sign = is_negative() ^ other.is_negative();
-
- return result;
+ return bitwise_or(other).minus(bitwise_and(other));
}
bool SignedBigInteger::operator==(const UnsignedBigInteger& other) const