Skip to content

Add trait UnsignedAbs #315

@emilk

Description

@emilk

All signed rust integer types has an unsgined_abs function, e.g. (-7_i32).unsigned_abs() == 7_u32, which is there to correctly handle i32::MIN (which cannot be negated as a i32).

I suggest we either add this to PrimInt (returning identify for unsigned integers), or add a new UnsignedAbs trait for this.

I'd be happy to make a PR if this sounds good.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions