Create operators.md

This commit is contained in:
d0cd 2022-08-03 12:04:39 -07:00 committed by GitHub
parent d8511d34c1
commit 140c2b31ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

57
docs/operators.md Normal file
View File

@ -0,0 +1,57 @@
# Leo Operators
|Leo Syntax | Aleo Instruction | Description |
| --------------------------------- |--------------------------------- | ----------------------------------|
|`.abs()` | `abs` | Absolute value operation |
| `.abs_wrapped()`| `abs.w` | Wrapping absolute value operation |
| `+`, `+=`, `.add(..)` | `add` | Addition operation |
|`.add_wrapped(..)`| `add.w` | Wrapping add operation |
|`&`, `&=`, `.and(..)`| `and` | Bitwise AND operation |
|`&&`, `&&=`, `.and(..)` | `and` | Logical AND operation |
|`BHP256::commit(..)`| `commit.bhp256` | 256-bit input BHP commitment |
| `BHP512::commit(..)`| `commit.bhp512` | 512-bit input BHP commitment |
| `BHP768::commit(..)`| `commit.bhp768` | 768-bit input BHP commitment |
| `BHP1024::commit(..)`| `commit.bhp1024` | 1024-bit input BHP commitment |
| `/`, `/=`, `.div(..)` | `div` | Division operation |
| `.div_wrapped(..)`| `div.w` | Wrapping division operation |
| `.double(..)`| `double` | Double operation |
| `>`, `.gt(..)`| `gt` | Greater than comparison |
| `>=`, `.gte(..)`| `gte` | Greater than or equal to comparison|
|`BHP256::hash(..)`| `hash.bhp256` | 256-bit input BHP hash |
| `BHP512::hash(..)`| `hash.bhp512` | 512-bit input BHP hash |
| `BHP768::hash(..)`| `hash.bhp768` | 768-bit input BHP hash |
| `BHP1024::hash(..)`| `hash.bhp1024` | 1024-bit input BHP hash |
| `Pedersen64::hash(..)`| `hash.ped64` | 64-bit input Pedersen hash |
| `Pedersen128::hash(..)`| `hash.ped128` | 128-bit input Pedersen hash |
| `Poseidon2::hash(..)`| `hash.psd2` | Poseidon hash with input rate 2 |
| `Poseidon4::hash(..)`| `hash.psd4` | Poseidon hash with input rate 4 |
| `Poseidon8::hash(..)`| `hash.psd8` | Poseidon hash with input rate 8 |
| `.inv(..)` | `inv` | Multiplicative inverse operation |
| `==`, `.eq(..)`| `is.eq` | Equality comparison |
|`!=`, `.neq(..)`| `is.neq` | Not equal comparison |
| `<`, `.lt(..)`| `lt` | Less than comparison |
| `<=`, `.lte(..)`| `lte` | Less than or equal to comparison |
| `.mod(..)` | `mod` | Arithmetic modulo operation |
| `*`, `*=`, `.mul(..)`| `mul` | Multiplication operation |
| `.mul_wrapped(..)`| `mul.w` | Wrapping multiplication operation |
| `.nand(..)` | `nand` | `Boolean` NAND operation |
| `-`, `.neg()`| `neg` | Additive inverse operation |
| `.nor(..)`| `nor` | `Boolean` NOR operation |
| `!`, `.not()`| `not` | NOT operation |
| `\|`, `\|=`, `.or(..)` | `or` | Bitwise OR Operation |
| `\|\|`, `\|\|=`, `.or(..)` | `or` | Logical OR Operation |
| `**`, `**=`, `.pow(..)`| `pow` | Exponentiation operation |
|`.pow_wrapped(..)`| `pow.w` | Wrapping exponentiation operation |
| `%`, `%=`, `.rem(..)`| `rem` | Remainder operation |
| `.rem_wrapped(..)`| `rem.w` | Wrapping remainder operation |
| `<<`, `<<=`, `.shl(..)`| `shl` | Shift left operation |
| `.shl_wrapped(..)`| `shl.w` | Wrapping Shift left operation |
| `>>`, `>>=`, `.shr(..)`| `shr` | Shift right operation |
| `.shr_wrapped(..)`| `shr.w` | Wrapping Shift right operation |
| `.sqrt()`| `sqrt` | Square root operation |
|`-`, `-=`, `.sub(..)`| `sub` | Subtraction operation |
|`.sub_wrapped(..)`| `sub.w` | Wrapping Subtraction operation |
|`.square()`| `square` | Square operation |
|`condition ? first : second`| `ternary` | Ternary select operation |
|`^`, `^=`, `.xor(..)` | `xor` | XOR operation |