rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.29k stars 12.58k forks source link

Tracking Issue for `unsigned_signed_diff` #126041

Open davidzeng0 opened 3 months ago

davidzeng0 commented 3 months ago

Feature gate: #![feature(unsigned_signed_diff)]

This is a tracking issue for https://github.com/rust-lang/libs-team/issues/381

Public API

impl uX {
        pub const fn overflowing_signed_diff(self, rhs: Self) -> (iX, bool);
    pub const fn saturating_signed_diff(self, rhs: Self) -> iX;
    pub const fn checked_signed_diff(self, rhs: Self) -> Option<iX>;
}

Steps / History

Unresolved Questions

davidzeng0 commented 3 months ago

For completeness, I could also implement https://github.com/rust-lang/libs-team/issues/381#issuecomment-2136024294

impl iX {
    fn checked_unsigned_diff(self, rhs: Self) -> Option<uX>;
}