Assign-operators for Uint.
This commit is contained in:
parent
60678a21a6
commit
512eee04cf
@ -1,4 +1,5 @@
|
||||
#![feature(op_assign_traits)]
|
||||
#![feature(augmented_assignments)]
|
||||
#![feature(associated_consts)]
|
||||
#![feature(wrapping)]
|
||||
//! Ethcore-util library
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/** libkeccak-tiny
|
||||
|
32
src/uint.rs
32
src/uint.rs
@ -474,6 +474,38 @@ macro_rules! construct_uint {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: optimise and traitify.
|
||||
|
||||
impl<'a> AddAssign<&'a $name> for $name {
|
||||
fn add_assign(&mut self, other: &'a Self) {
|
||||
*self = self.add(*other);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> SubAssign<&'a $name> for $name {
|
||||
fn sub_assign(&mut self, other: &'a Self) {
|
||||
*self = self.sub(*other);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MulAssign<&'a $name> for $name {
|
||||
fn mul_assign(&mut self, other: &'a Self) {
|
||||
*self = self.mul(*other);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DivAssign<&'a $name> for $name {
|
||||
fn div_assign(&mut self, other: &'a Self) {
|
||||
*self = self.div(*other);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RemAssign<&'a $name> for $name {
|
||||
fn rem_assign(&mut self, other: &'a Self) {
|
||||
*self = self.rem(*other);
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<$name> for $name {
|
||||
type Output = $name;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user