Very basic EVM binary. (#1574)

* EVM binary - initial version

* Adding missing documentation

* Fixing warnings

* Basic evmbin options

* EVMbin crate.
This commit is contained in:
Tomasz Drwięga
2016-07-11 09:42:41 +02:00
committed by Gav Wood
parent e15f631ec7
commit 2ed09de38e
7 changed files with 1299 additions and 3 deletions

View File

@@ -95,11 +95,17 @@ impl<'a> Finalize for Result<GasLeft<'a>> {
}
}
/// Cost calculation type. For low-gas usage we calculate costs using usize instead of U256
pub trait CostType: ops::Mul<Output=Self> + ops::Div<Output=Self> + ops::Add<Output=Self> + ops::Sub<Output=Self> + ops::Shr<usize, Output=Self> + ops::Shl<usize, Output=Self> + cmp::Ord + Sized + From<usize> + Copy {
/// Converts this cost into `U256`
fn as_u256(&self) -> U256;
/// Tries to fit `U256` into this `Cost` type
fn from_u256(val: U256) -> Result<Self>;
/// Convert to usize (may panic)
fn as_usize(&self) -> usize;
/// Add with overflow
fn overflow_add(self, other: Self) -> (Self, bool);
/// Multiple with overflow
fn overflow_mul(self, other: Self) -> (Self, bool);
}