alloy-rs / alloy-rs/ruint

`base_convert`: Same trick as with `to_base_le`, find the largest power of base

オープン
#68 コメント 0 件 リアクション 0 件 担当者 1 名 @recmo が担当を希望しています GitHub で見る
optimize tracker
主要言語
Rust
スター
225
フォーク
70
平均マージ
16時間 54分
マージ済み PR(30日)
8

説明

*On 2022-05-28 @recmo wrote in [`b0b5d54`](https://github.com/recmo/uint/commit/b0b5d5401643d19747653934e838604cd59bcd81) “Mod names”:*

Same trick as with `to_base_le`, find the largest power of base
that fits `u64` and accumulate there first.

```rust
base: u64,
digits: I,
) -> Result {
// OPT: Special handling of bases that divide 2^64, and bases that are
// powers of 2.
// OPT: Same trick as with `to_base_le`, find the largest power of base
// that fits `u64` and accumulate there first.
if base < 2 {
return Err(BaseConvertError::InvalidBase(base));
}
let mut result = Self::ZERO;
for digit in digits {

```
*From [`src/base_convert.rs:82`](https://github.com/recmo/uint/blob/b0b5d5401643d19747653934e838604cd59bcd81/src/base_convert.rs#L82)*

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。