paritytech / parity-common

Collection of crates used in Parity projects
https://www.paritytech.io/
Apache License 2.0
290 stars 218 forks source link

U256 type does not support `num_traits::int::PrimInt` #714

Closed gilescope closed 1 year ago

gilescope commented 1 year ago

and so IntegerSqrt is not supported. integer-sqrt has a blanket impl for anything that supports the num_traits::PrimInt.

https://crates.io/crates/integer-sqrt

ordian commented 1 year ago

I've implemented integer_sqrt as an inherent method, because the one provided by the crate is slow https://github.com/paritytech/parity-common/pull/554

gilescope commented 1 year ago

Nice - should have spotted that feature. Now I just need to get checked add / mul / div / sub supported for U256.

gilescope commented 1 year ago

This should cover it: https://github.com/paritytech/parity-common/pull/716