Assign-operators for Uint.

This commit is contained in:
Gav Wood 2016-01-16 16:26:46 +01:00
parent 60678a21a6
commit 512eee04cf
4 changed files with 34 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#![feature(op_assign_traits)] #![feature(op_assign_traits)]
#![feature(augmented_assignments)]
#![feature(associated_consts)] #![feature(associated_consts)]
#![feature(wrapping)] #![feature(wrapping)]
//! Ethcore-util library //! Ethcore-util library

View File

@ -567,7 +567,7 @@ impl<Message> IoHandler<NetworkIoMessage<Message>> for Host<Message> where Messa
self.add_node("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"); // BR self.add_node("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"); // BR
self.add_node("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"); // SG self.add_node("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"); // SG
// ETH/DEV cpp-ethereum (poc-9.ethdev.com) // ETH/DEV cpp-ethereum (poc-9.ethdev.com)
self.add_node("enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"); self.add_node("enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303");
} }
fn stream_hup<'s>(&'s mut self, io: &mut IoContext<'s, NetworkIoMessage<Message>>, stream: StreamToken) { fn stream_hup<'s>(&'s mut self, io: &mut IoContext<'s, NetworkIoMessage<Message>>, stream: StreamToken) {

View File

@ -1,6 +1,4 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
/** libkeccak-tiny /** libkeccak-tiny

View File

@ -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 { impl BitAnd<$name> for $name {
type Output = $name; type Output = $name;