3 stable releases
3.0.0 | Sep 7, 2020 |
---|---|
2.0.0 | Sep 7, 2020 |
1.0.0 | Oct 10, 2018 |
#4 in #abs
Used in lebicon
7KB
56 lines
uabs
This crate provides the UnsignedAbs
trait containing a function uabs()
which calculates the absolute value of the input and returns it as an
unsigned integer of the same size as the input. For example:
use uabs::Uabs;
let x: i8 = -128;
let y: u8 = x.uabs();
assert_eq!(y, 128);
License: Apache-2.0
lib.rs
:
This crate provides the UnsignedAbs
trait containing a function uabs()
which calculates the absolute value of the input and returns it as an
unsigned integer of the same size as the input. For example:
use uabs::Uabs;
let x: i8 = -128;
let y: u8 = x.uabs();
assert_eq!(y, 128);
Dependencies
~7KB