Fix indentation.

This commit is contained in:
Tomasz Drwięga 2018-01-28 17:51:53 +01:00
parent ea29612eaa
commit d0e82be286
1 changed files with 41 additions and 41 deletions

View File

@ -815,13 +815,13 @@ macro_rules! construct_uint {
}
}
/// Checked addition. Returns `None` if overflow occurred.
pub fn checked_add(self, other: $name) -> Option<$name> {
match self.overflowing_add(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Checked addition. Returns `None` if overflow occurred.
pub fn checked_add(self, other: $name) -> Option<$name> {
match self.overflowing_add(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Subtraction which underflows and returns a flag if it does.
#[inline(always)]
@ -837,13 +837,13 @@ macro_rules! construct_uint {
}
}
/// Checked subtraction. Returns `None` if overflow occurred.
pub fn checked_sub(self, other: $name) -> Option<$name> {
match self.overflowing_sub(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Checked subtraction. Returns `None` if overflow occurred.
pub fn checked_sub(self, other: $name) -> Option<$name> {
match self.overflowing_sub(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Multiply with overflow, returning a flag if it does.
#[inline(always)]
@ -859,27 +859,27 @@ macro_rules! construct_uint {
}
}
/// Checked multiplication. Returns `None` if overflow occurred.
pub fn checked_mul(self, other: $name) -> Option<$name> {
match self.overflowing_mul(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Checked multiplication. Returns `None` if overflow occurred.
pub fn checked_mul(self, other: $name) -> Option<$name> {
match self.overflowing_mul(other) {
(_, true) => None,
(val, _) => Some(val),
}
}
/// Division with overflow
pub fn overflowing_div(self, other: $name) -> ($name, bool) {
(self / other, false)
}
/// Checked division. Returns `None` if `other == 0`.
pub fn checked_div(self, other: $name) -> Option<$name> {
if other.is_zero() {
None
} else {
Some(self / other)
}
}
/// Checked division. Returns `None` if `other == 0`.
pub fn checked_div(self, other: $name) -> Option<$name> {
if other.is_zero() {
None
} else {
Some(self / other)
}
}
/// Modulus with overflow.
pub fn overflowing_rem(self, other: $name) -> ($name, bool) {
@ -888,11 +888,11 @@ macro_rules! construct_uint {
/// Checked modulus. Returns `None` if `other == 0`.
pub fn checked_rem(self, other: $name) -> Option<$name> {
if other.is_zero() {
None
} else {
Some(self % other)
}
if other.is_zero() {
None
} else {
Some(self % other)
}
}
/// Negation with overflow.
@ -904,13 +904,13 @@ macro_rules! construct_uint {
}
}
/// Checked negation. Returns `None` unless `self == 0`.
pub fn checked_neg(self) -> Option<$name> {
match self.overflowing_neg() {
(_, true) => None,
(zero, false) => Some(zero),
}
}
/// Checked negation. Returns `None` unless `self == 0`.
pub fn checked_neg(self) -> Option<$name> {
match self.overflowing_neg() {
(_, true) => None,
(zero, false) => Some(zero),
}
}
/// Multiplication by u32
pub fn mul_u32(self, other: u32) -> Self {