LibCrypto: Introduce a falible API for SignedBigInteger::shift_left

This commit is contained in:
Jess 2025-02-19 02:20:30 +13:00 committed by Tim Flynn
commit 8fda05d8b7
Notes: github-actions[bot] 2025-02-19 14:02:02 +00:00
6 changed files with 48 additions and 8 deletions

View file

@ -481,17 +481,22 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_not_fill_to_one_based_ind
return result;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::shift_left(size_t num_bits) const
FLATTEN ErrorOr<UnsignedBigInteger> UnsignedBigInteger::try_shift_left(size_t num_bits) const
{
UnsignedBigInteger output;
UnsignedBigInteger temp_result;
UnsignedBigInteger temp_plus;
UnsignedBigIntegerAlgorithms::shift_left_without_allocation(*this, num_bits, temp_result, temp_plus, output);
TRY(UnsignedBigIntegerAlgorithms::try_shift_left_without_allocation(*this, num_bits, temp_result, temp_plus, output));
return output;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::shift_left(size_t num_bits) const
{
return MUST(try_shift_left(num_bits));
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::shift_right(size_t num_bits) const
{
UnsignedBigInteger output;