Template Class comparison_operations#

Class Documentation#

template<class params>
class comparison_operations#

The comparison operations class. Contains the next operations 10s: Comparison Operations:

  • LT

  • GT

  • SLT

  • SGT

  • EQ

  • ISZERO

Public Types

typedef arith_env_t<params> arith_t#

The arithmetical environment used by the arbitrary length integer library.

typedef arith_t::bn_t bn_t#

The arbitrary length integer type.

typedef stack_t<params> stack_t#

The stackk class.

Public Static Functions

static inline __host__ __device__ __forceinline__ int32_t compare (arith_t &arith, uint32_t &error_code, stack_t &stack)

Compare the top two values from the stack. The two values are considered unsigned. -1 if the first value is less than the second value, 0 if the first value is equal to the second value, 1 if the first value is greater than the second value.

Parameters
  • arith[in] The arithmetical environment.

  • error_code[out] The error code.

  • stack[inout] The stack.

Returns

The result of the comparison.

static inline __host__ __device__ __forceinline__ int32_t scompare (arith_t &arith, uint32_t &error_code, stack_t &stack)

Compare the top two values from the stack. The two values are considered signed. -1 if the first value is less than the second value, 0 if the first value is equal to the second value, 1 if the first value is greater than the second value.

Parameters
  • arith[in] The arithmetical environment.

  • error_code[out] The error code.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_LT (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The LT operation implementation. Takes two values from the stack, compares them and pushes the result back to the stack. The two values are considered unsigned. The result is 1 if the first value is less than the second value, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_GT (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The GT operation implementation. Takes two values from the stack, compares them and pushes the result back to the stack. The two values are considered unsigned. The result is 1 if the first value is greater than the second value, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_SLT (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The SLT operation implementation. Takes two values from the stack, compares them and pushes the result back to the stack. The two values are considered signed. The result is 1 if the first value is less than the second value, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_SGT (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The SGT operation implementation. Takes two values from the stack, compares them and pushes the result back to the stack. The two values are considered signed. The result is 1 if the first value is greater than the second value, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_EQ (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The EQ operation implementation. Takes two values from the stack, compares them and pushes the result back to the stack. The result is 1 if the first value is equal to the second value, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.

static inline __host__ __device__ __forceinline__ void operation_ISZERO (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack)

The ISZERO operation implementation. Takes a value from the stack, compares it with zero and pushes the result back to the stack. The result is 1 if the value is equal to zero, 0 otherwise.

Parameters
  • arith[in] The arithmetical environment.

  • gas_limit[in] The gas limit.

  • gas_used[inout] The gas used.

  • error_code[out] The error code.

  • pc[inout] The program counter.

  • stack[inout] The stack.