Skip to content

Generalize the few functions that are not common across all the core integer modules #2239

Description

@brson

The uint/int/i8 etc modules mostly share the same code but there are a few functions that are still specific to a single module. It should be possible to move these to the int-template or uint-template module as appropriate so they can be used for all integer types.

These are they:

  • int::{ hash, parse_buf, from_str, to_str, str, pow }
  • uint::{ div_ceil, div_round, div_floor, hash, iterate }
  • uint::{ next_power_of_two, parse_buf, from_str, to_str, str }
  • u64::{ to_str, str, from_str }

Activity

  1. graydon commented on Aug 8, 2012

    @graydon
    Contributor

    This feels nearly-done to me, you agree?

  2. Aatch commented on Jun 7, 2013

    @Aatch
    Contributor

    Is this done now? With the extensive re-working of std::num we don't even have [u]int-template any more.

  3. thestinger commented on Aug 5, 2013

    @thestinger
    Contributor

    Instead of the template we have macros generating non-generic functions now.

  4. thestinger commented on Aug 20, 2013

    @thestinger
    Contributor

    There's no longer a lack of code reuse, but definitely a lack of generic functions rather than generated code. These are often very hard to write without missing corner cases, so they can be tackled individually.

  5. added a commit that references this issue on Sep 22, 2022
  6. added a commit that references this issue on Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions