Use BN_set_bit in TestLShift1.
No need for the special case and such.
Change-Id: If8fbc73eda0ccbaf3fd422e97c96fee6dc10b1ab
Reviewed-on: https://boringssl-review.googlesource.com/8604
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/bn/bn_test.cc b/crypto/bn/bn_test.cc
index fe6e0b7..151164e 100644
--- a/crypto/bn/bn_test.cc
+++ b/crypto/bn/bn_test.cc
@@ -422,17 +422,8 @@
}
// Set the LSB to 1 and test rshift1 again.
- if (BN_is_negative(lshift1.get())) {
- if (!BN_sub(lshift1.get(), lshift1.get(), BN_value_one())) {
- return false;
- }
- } else {
- if (!BN_add(lshift1.get(), lshift1.get(), BN_value_one())) {
- return false;
- }
- }
-
- if (!BN_div(ret.get(), nullptr /* rem */, lshift1.get(), two.get(), ctx) ||
+ if (!BN_set_bit(lshift1.get(), 0) ||
+ !BN_div(ret.get(), nullptr /* rem */, lshift1.get(), two.get(), ctx) ||
!ExpectBIGNUMsEqual(t, "(LShift1 | 1) / 2", a.get(), ret.get()) ||
!BN_rshift1(ret.get(), lshift1.get()) ||
!ExpectBIGNUMsEqual(t, "(LShift | 1) >> 1", a.get(), ret.get())) {