miden-core-lib 0.22.4

Miden VM core library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

## miden::core::math::u256
| Procedure | Description |
| ----------- | ------------- |
| wrapping_add | Performs addition of two unsigned 256 bit integers discarding the overflow.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = (a + b) % 2^256.<br /> |
| overflowing_add | Performs addition of two unsigned 256 bit integers preserving the overflow.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [overflow, c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = (a + b) % 2^256.<br /> |
| widening_add | Performs addition of two unsigned 256 bit integers preserving the overflow with sum on top.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, overflow, ...], where c = (a + b) % 2^256.<br /> |
| wrapping_sub | Performs subtraction of two unsigned 256 bit integers discarding the underflow.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = (a - b) % 2^256.<br /> |
| overflowing_sub | Performs subtraction of two unsigned 256 bit integers preserving the underflow.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [underflow, c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = (a - b) % 2^256.<br /> |
| and | Computes bitwise AND of two unsigned 256 bit integers.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = a & b.<br /> |
| or | Computes bitwise OR of two unsigned 256 bit integers.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = a \| b.<br /> |
| xor | Computes bitwise XOR of two unsigned 256 bit integers.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...]<br />-> [c0, c1, c2, c3, c4, c5, c6, c7, ...], where c = a ^ b.<br /> |
| eqz | Returns 1 if the top u256 value is zero; lower stack values are preserved.<br />Stack transition looks as follows:<br />[a0, a1, a2, a3, a4, a5, a6, a7, ...] -> [is_zero, ...].<br /> |
| eq | Returns 1 if two unsigned 256 bit integers are equal.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...] -> [is_equal, ...].<br /> |
| wrapping_mul | Performs multiplication of two unsigned 256 bit integers discarding the overflow.<br />The input values are assumed to be represented using 32 bit limbs, but this is not checked.<br />Stack transition looks as follows:<br />[b0, b1, b2, b3, b4, b5, b6, b7, a0, a1, a2, a3, a4, a5, a6, a7, ...] -> [c0, c1, c2, c3, c4, c5, c6, c7, ...]<br />where c = (a * b) % 2^256, and a0, b0, and c0 are least significant 32-bit limbs of a, b, and c respectively.<br /> |