LibCrypto+LibJS: Move Power to method of {Unsigned,Signed}BigInteger

Having it as a method instead of a free function is necessary for the
next commits and generally allows for optimizations that require deeper
access into the `UnsignedBigInteger` / `SignedBigInteger`.

Also restrict the exponent to 32 bits to avoid huge memory allocations.
This commit is contained in:
devgianlu 2025-04-26 11:17:32 +02:00 committed by Jelle Raaijmakers
commit 5a4cfd05d0
Notes: github-actions[bot] 2025-05-23 09:58:36 +00:00
7 changed files with 53 additions and 46 deletions

View file

@ -109,6 +109,7 @@ public:
[[nodiscard]] UnsignedBigInteger as_n_bits(size_t n) const;
[[nodiscard]] UnsignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
[[nodiscard]] UnsignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const;
[[nodiscard]] UnsignedBigInteger pow(u32 exponent) const;
[[nodiscard]] UnsignedBigInteger gcd(UnsignedBigInteger const& other) const;
[[nodiscard]] ErrorOr<UnsignedBigInteger> try_bitwise_not_fill_to_one_based_index(size_t) const;