alloy-rs / alloy-rs/ruint

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

未关闭
#68 0 条评论 0 个 reaction 已指派 1 人 已被 @recmo 认领 在 GitHub 查看
optimize tracker
主要语言
Rust
星标
225
派生
70
平均合并
16 小时 54 分钟
30 天内合并 PR
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 摘要。