leo/docs/operators.md
2022-08-03 12:04:39 -07:00

4.5 KiB

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