Implement ShrAssign and ShlAssign for BigUint
This commit is contained in:
parent
2f6c0bf354
commit
555dab7d33
|
@ -1,7 +1,9 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub, AddAssign, SubAssign, MulAssign, DivAssign, RemAssign, BitAndAssign, BitOrAssign, BitXorAssign};
|
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub,
|
||||||
|
AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign,
|
||||||
|
MulAssign, RemAssign, ShlAssign, ShrAssign, SubAssign};
|
||||||
use std::str::{self, FromStr};
|
use std::str::{self, FromStr};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
@ -346,7 +348,6 @@ impl Shl<usize> for BigUint {
|
||||||
biguint_shl(Cow::Owned(self), rhs)
|
biguint_shl(Cow::Owned(self), rhs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Shl<usize> for &'a BigUint {
|
impl<'a> Shl<usize> for &'a BigUint {
|
||||||
type Output = BigUint;
|
type Output = BigUint;
|
||||||
|
|
||||||
|
@ -356,6 +357,13 @@ impl<'a> Shl<usize> for &'a BigUint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ShlAssign<usize> for BigUint {
|
||||||
|
#[inline]
|
||||||
|
fn shl_assign(&mut self, rhs: usize) {
|
||||||
|
*self = biguint_shl(Cow::Borrowed(&*self), rhs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Shr<usize> for BigUint {
|
impl Shr<usize> for BigUint {
|
||||||
type Output = BigUint;
|
type Output = BigUint;
|
||||||
|
|
||||||
|
@ -364,7 +372,6 @@ impl Shr<usize> for BigUint {
|
||||||
biguint_shr(Cow::Owned(self), rhs)
|
biguint_shr(Cow::Owned(self), rhs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Shr<usize> for &'a BigUint {
|
impl<'a> Shr<usize> for &'a BigUint {
|
||||||
type Output = BigUint;
|
type Output = BigUint;
|
||||||
|
|
||||||
|
@ -374,6 +381,13 @@ impl<'a> Shr<usize> for &'a BigUint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ShrAssign<usize> for BigUint {
|
||||||
|
#[inline]
|
||||||
|
fn shr_assign(&mut self, rhs: usize) {
|
||||||
|
*self = biguint_shr(Cow::Borrowed(&*self), rhs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Zero for BigUint {
|
impl Zero for BigUint {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn zero() -> BigUint {
|
fn zero() -> BigUint {
|
||||||
|
|
Loading…
Reference in New Issue