Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

I256

A signed 256-bit integer implementation for handling negative amounts.This struct represents a signed integer by storing the absolute value and a sign flag, enabling arithmetic operations with negative numbers. # Fields - value: The absolute value as an unsigned 256-bit integer - is_negative: Boolean flag indicating if the value is negative # Examples

// Positive number: 100
let positive = I256 { value: 100, is_negative: false };

// Negative number: -100
let negative = I256 { value: 100, is_negative: true };

// Zero (always positive)
let zero = I256 { value: 0, is_negative: false };

Fully qualified path: obscura::custom_type::i256::I256

#[derive(Debug, Drop, Clone, Copy, PartialEq, Serde)]
pub struct I256 {
    pub value: u256,
    pub is_negative: bool,
}

Members

value

The absolute value of the integer. This field stores the magnitude regardless of sign.

Fully qualified path: obscura::custom_type::i256::I256::value

pub value: u256

is_negative

Flag indicating whether the value is negative. When true, the actual value is -value; when false, it's +value.

Fully qualified path: obscura::custom_type::i256::I256::is_negative

pub is_negative: bool