ionspin / kotlin-multiplatform-bignum

A Kotlin multiplatform library for arbitrary precision arithmetics
Apache License 2.0
339 stars 40 forks source link

Make BigInteger.arithmetic public #254

Closed andreypfau closed 1 year ago

andreypfau commented 1 year ago

Motivation:

I need a method to get the length of a number in bits (BigIntegerArithmetic.bitLength), besides this interface is public, but there are no ways to get an instance except through this constant

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

ionspin commented 1 year ago

Hi @andreypfau, thank you for your contribution! My initial intuition is that this would be better handled if there was a function bitLenght() in BigInteger that returns number of bits instead of exposing the BigIntegerArithmetic which works on ULong arrays.

The function would just call the arithmetic like in this line

Would that work for you?

andreypfau commented 1 year ago

Yep, That would be great

ionspin commented 1 year ago

Completed in #255