> For the complete documentation index, see [llms.txt](https://docs.play.cronos.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.play.cronos.org/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md).

# org::defi\_wallet\_core::U256

`#include <uint.rs.h>`

## Public Types

|                         | Name                                      |
| ----------------------- | ----------------------------------------- |
| using ::std::true\_type | [**IsRelocatable**](#using-isrelocatable) |

## Public Functions

|                                                                                                                            | Name                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ::[rust::String](/readme-1/classes/classrust_1_1cxxbridge1_1_1_string.md)                                                  | <p><a href="#function-to-string"><strong>to\_string</strong></a>() const<br>Convert to Decimal String.</p>                                                                                                                                                                                                                           |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-saturating-add"><strong>saturating\_add</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Addition which saturates at the maximum value.</p>                                                                            |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-saturating-sub"><strong>saturating\_sub</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Subtraction which saturates at zero.</p>                                                                                      |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-saturating-mul"><strong>saturating\_mul</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Multiplication which saturates at maximum value.</p>                                                                          |
| ::[org::defi\_wallet\_core::U256WithOverflow](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256_with_overflow.md) | <p><a href="#function-overflowing-add"><strong>overflowing\_add</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns the addition along with a boolean indicating whether an arithmetic overflow would occur.</p>                        |
| ::[org::defi\_wallet\_core::U256WithOverflow](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256_with_overflow.md) | <p><a href="#function-overflowing-sub"><strong>overflowing\_sub</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns the subtraction along with a boolean indicating whether an arithmetic overflow would occur.</p>                     |
| ::[org::defi\_wallet\_core::U256WithOverflow](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256_with_overflow.md) | <p><a href="#function-overflowing-mul"><strong>overflowing\_mul</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns the multiplication along with a boolean indicating whether an arithmetic overflow would occur.</p>                  |
| ::[org::defi\_wallet\_core::U256WithOverflow](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256_with_overflow.md) | <p><a href="#function-overflowing-pow"><strong>overflowing\_pow</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns the fast exponentiation by squaring along with a boolean indicating whether an arithmetic overflow would occur.</p> |
| ::[org::defi\_wallet\_core::U256WithOverflow](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256_with_overflow.md) | <p><a href="#function-overflowing-neg"><strong>overflowing\_neg</strong></a>() const<br>Negates self in an overflowing fashion.</p>                                                                                                                                                                                                  |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-add"><strong>add</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>add, exception is rasided if overflow</p>                                                                                                            |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-sub"><strong>sub</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>sub, exception is rasided if overflow</p>                                                                                                            |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-mul"><strong>mul</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>mul, exception is rasided if overflow</p>                                                                                                            |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-pow"><strong>pow</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>pow, exception is rasided if overflow</p>                                                                                                            |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-neg"><strong>neg</strong></a>() const<br>Negates self in an overflowing fashion.</p>                                                                                                                                                                                                                           |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-div"><strong>div</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns a pair <code>(self / other)</code></p>                                                                                                       |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-rem"><strong>rem</strong></a>(::<a href="/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md">org::defi\_wallet\_core::U256</a> other) const<br>Returns a pair <code>(self % other)</code></p>                                                                                                       |
| void                                                                                                                       | <p><a href="#function-to-big-endian"><strong>to\_big\_endian</strong></a>(::<a href="/readme-1/classes/classrust_1_1cxxbridge1_1_1_vec.md">rust::Vec</a><::std::uint8\_t > & bytes) const<br>Write to the slice in big-endian format.</p>                                                                                            |
| void                                                                                                                       | <p><a href="#function-to-little-endian"><strong>to\_little\_endian</strong></a>(::<a href="/readme-1/classes/classrust_1_1cxxbridge1_1_1_vec.md">rust::Vec</a><::std::uint8\_t > & bytes) const<br>Write to the slice in little-endian format.</p>                                                                                   |
| ::[org::defi\_wallet\_core::U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md)                           | <p><a href="#function-format-ether"><strong>format\_ether</strong></a>() const<br>Format the output for the user which prefer to see values in ether (instead of wei) Divides the input by 1e18.</p>                                                                                                                                 |
| ::[rust::String](/readme-1/classes/classrust_1_1cxxbridge1_1_1_string.md)                                                  | <p><a href="#function-format-units"><strong>format\_units</strong></a>(::<a href="/readme-1/classes/classrust_1_1cxxbridge1_1_1_string.md">rust::String</a> units) const<br>Convert to common ethereum unit types: ether, gwei, or wei formatted in <em>ETH decimals</em> (e.g.</p>                                                  |
| bool                                                                                                                       | [**operator==**](#function-operator==)([U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md) const & ) const                                                                                                                                                                                                         |
| bool                                                                                                                       | [**operator!=**](#function-operator!=)([U256](/readme-1/classes/structorg_1_1defi__wallet__core_1_1_u256.md) const & ) const                                                                                                                                                                                                         |

## Public Attributes

|                                    | Name                       |
| ---------------------------------- | -------------------------- |
| ::std::array<::std::uint64\_t, 4 > | [**data**](#variable-data) |

## Public Types Documentation

### using IsRelocatable

```cpp
using org::defi_wallet_core::U256::IsRelocatable =  ::std::true_type;
```

## Public Functions Documentation

### function to\_string

```cpp
::rust::String to_string() const
```

Convert to Decimal String.

### function saturating\_add

```cpp
::org::defi_wallet_core::U256 saturating_add(
    ::org::defi_wallet_core::U256 other
) const
```

Addition which saturates at the maximum value.

### function saturating\_sub

```cpp
::org::defi_wallet_core::U256 saturating_sub(
    ::org::defi_wallet_core::U256 other
) const
```

Subtraction which saturates at zero.

### function saturating\_mul

```cpp
::org::defi_wallet_core::U256 saturating_mul(
    ::org::defi_wallet_core::U256 other
) const
```

Multiplication which saturates at maximum value.

### function overflowing\_add

```cpp
::org::defi_wallet_core::U256WithOverflow overflowing_add(
    ::org::defi_wallet_core::U256 other
) const
```

Returns the addition along with a boolean indicating whether an arithmetic overflow would occur.

If an overflow would have occurred then the wrapped value is returned.

### function overflowing\_sub

```cpp
::org::defi_wallet_core::U256WithOverflow overflowing_sub(
    ::org::defi_wallet_core::U256 other
) const
```

Returns the subtraction along with a boolean indicating whether an arithmetic overflow would occur.

If an overflow would have occurred then the wrapped value is returned.

### function overflowing\_mul

```cpp
::org::defi_wallet_core::U256WithOverflow overflowing_mul(
    ::org::defi_wallet_core::U256 other
) const
```

Returns the multiplication along with a boolean indicating whether an arithmetic overflow would occur.

If an overflow would have occurred then the wrapped value is returned.

### function overflowing\_pow

```cpp
::org::defi_wallet_core::U256WithOverflow overflowing_pow(
    ::org::defi_wallet_core::U256 other
) const
```

Returns the fast exponentiation by squaring along with a boolean indicating whether an arithmetic overflow would occur.

If an overflow would have occurred then the wrapped value is returned.

### function overflowing\_neg

```cpp
::org::defi_wallet_core::U256WithOverflow overflowing_neg() const
```

Negates self in an overflowing fashion.

Returns !self + 1 using wrapping operations to return the value that represents the negation of this unsigned value. Note that for positive unsigned values overflow always occurs, but negating 0 does not overflow.

### function add

```cpp
::org::defi_wallet_core::U256 add(
    ::org::defi_wallet_core::U256 other
) const
```

add, exception is rasided if overflow

### function sub

```cpp
::org::defi_wallet_core::U256 sub(
    ::org::defi_wallet_core::U256 other
) const
```

sub, exception is rasided if overflow

### function mul

```cpp
::org::defi_wallet_core::U256 mul(
    ::org::defi_wallet_core::U256 other
) const
```

mul, exception is rasided if overflow

### function pow

```cpp
::org::defi_wallet_core::U256 pow(
    ::org::defi_wallet_core::U256 other
) const
```

pow, exception is rasided if overflow

### function neg

```cpp
::org::defi_wallet_core::U256 neg() const
```

Negates self in an overflowing fashion.

Returns !self + 1 using wrapping operations to return the value that represents the negation of this unsigned value.

### function div

```cpp
::org::defi_wallet_core::U256 div(
    ::org::defi_wallet_core::U256 other
) const
```

Returns a pair `(self / other)`

### function rem

```cpp
::org::defi_wallet_core::U256 rem(
    ::org::defi_wallet_core::U256 other
) const
```

Returns a pair `(self % other)`

### function to\_big\_endian

```cpp
void to_big_endian(
    ::rust::Vec<::std::uint8_t > & bytes
) const
```

Write to the slice in big-endian format.

### function to\_little\_endian

```cpp
void to_little_endian(
    ::rust::Vec<::std::uint8_t > & bytes
) const
```

Write to the slice in little-endian format.

### function format\_ether

```cpp
::org::defi_wallet_core::U256 format_ether() const
```

Format the output for the user which prefer to see values in ether (instead of wei) Divides the input by 1e18.

### function format\_units

```cpp
::rust::String format_units(
    ::rust::String units
) const
```

Convert to common ethereum unit types: ether, gwei, or wei formatted in *ETH decimals* (e.g.

"1.50000...") wrapped as string

### function operator==

```cpp
bool operator==(
    U256 const & 
) const
```

### function operator!=

```cpp
bool operator!=(
    U256 const & 
) const
```

## Public Attributes Documentation

### variable data

```cpp
::std::array<::std::uint64_t, 4 > data;
```

***

Updated on 2023-01-11 at 18:25:18 +0800
