Skip to content

base_convert: Internalize this trick so the user won't have to worry about it. #67

@github-actions

Description

@github-actions

On 2023-08-13 @prestwich wrote in 55c5411 “Merge pull request #293 from recmo/remco/base-to”:

Internalize this trick so the user won't have to worry about it.
Panics

Panics if the base is less than 2.

    /// little-endian order.
    ///
    /// Pro tip: instead of setting `base = 10`, set it to the highest
    /// power of `10` that still fits `u64`. This way much fewer iterations
    /// are required to extract all the digits.
    // OPT: Internalize this trick so the user won't have to worry about it.
    /// # Panics
    ///
    /// Panics if the base is less than 2.
    #[inline]
    pub fn to_base_le(&self, base: u64) -> impl Iterator<Item = u64> {
        assert!(base > 1);
        SpigotLittle {
            base,

From src/base_convert.rs:46

Metadata

Metadata

Assignees

Labels

optimizePotential optimization opportunitytrackerIssue tracked by bot

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions