Trait vvm::vvm::CostType[][src]

pub trait CostType: Sized + From<usize> + Copy + Send + Mul<Output = Self> + Div<Output = Self> + Add<Output = Self> + Sub<Output = Self> + Shr<usize, Output = Self> + Shl<usize, Output = Self> + Ord + Debug {
    fn as_u256(&self) -> U256;
fn from_u256(val: U256) -> Result<Self>;
fn as_usize(&self) -> usize;
fn overflow_add(self, other: Self) -> (Self, bool);
fn overflow_mul(self, other: Self) -> (Self, bool);
fn overflow_mul_shr(self, other: Self, shr: usize) -> (Self, bool); }

Cost calculation type. For low-gas usage we calculate costs using usize instead of U256

Required methods

fn as_u256(&self) -> U256[src]

Converts this cost into U256

fn from_u256(val: U256) -> Result<Self>[src]

Tries to fit U256 into this Cost type

fn as_usize(&self) -> usize[src]

Convert to usize (may panic)

fn overflow_add(self, other: Self) -> (Self, bool)[src]

Add with overflow

fn overflow_mul(self, other: Self) -> (Self, bool)[src]

Multiple with overflow

fn overflow_mul_shr(self, other: Self, shr: usize) -> (Self, bool)[src]

Single-step full multiplication and shift: (self*other) >> shr Should not overflow on intermediate steps

Loading content...

Implementations on Foreign Types

impl CostType for U256[src]

impl CostType for usize[src]

Loading content...

Implementors

Loading content...