rust-lang / rust-lang/rust

Tracking Issue for signed bigint helper methods

Open
#151,989 34 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

Feature gate: #![feature(signed_bigint_helpers)]

This issue continues discussion #85532 with the following methods on integers:

  • uN::carrying_mul_add_signed
  • iN::overflowing_add_carry
  • iN::overflowing_sub_borrow
  • iN::carrying_mul
  • iN::carrying_mul_add
  • iN::carrying_mul_add_unsigned
impl uN {
    /// `add += self * rhs + carry`, covers full `i2N` range exactly
    fn carrying_mul_add_signed(self, rhs: iN, carry: Self, add: iN) -> (Self, iN);
}

impl iN {
    /// Returns `self + rhs + carry` and (signed) overflow flag;
    /// should be used for most significant limb only; shouldn't be chained
    fn overflowing_add_carry(self, rhs: Self, carry: bool) -> (Self, bool);
    
    /// Returns `self - rhs - borrow` and (signed) overflow flag;
    /// should be used for most significant limb only; shouldn't be chained
    fn overflowing_sub_borrow(self, rhs: Self, borrow: bool) -> (Self, bool);
    
    /// `self * rhs + carry`
    fn carrying_mul(self, rhs: Self, carry: Self) -> (uN, Self);
    
    /// `add += self * rhs + carry`, fits `i2N` range, but doesn't cover it fully
    fn carrying_mul_add(self, rhs: Self, carry: Self, add: Self) -> (uN, Self);
    
    /// `add += self * rhs + carry`, covers full `i2N` range exactly
    fn carrying_mul_add_unsigned(self, rhs: uN, carry: Self, add: uN) -> (uN, Self);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #85532 and the context for the signed_bigint_helpers feature gate. Use the listed method signatures and semantics to identify unresolved API and design decisions. Done means the scope is agreed and the signed bigint helpers are implemented with appropriate validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.