Basic solidity and ursus operators, respectively
Here is a mapping of operators from solidity and the phased construction of operators in ursus
Built-in operation for basic types
Arifmetic operations:
x + y
standart sum with number overflow:x
andy
has uint or int type- if one of the term has type uint and another has int, result will be int
- if one of the term has type uintN and another has uintM (N >= M), result will be uintN
- functions
x - y
,x * y
have the as same logic as the previous ones
TODO comparing addresses
- functions
x == y
,x != y
work with boleans and nums, functionsx < y
,x <= y
,x > y
,x >= y
works with nums. All of these functions have standart semanthic. x / y
standart division operation, but if at least one of the term is zero the result will be zero toox % y
standart modulo operation, but ifx
is zero then result will be zero too
Bitwise operations:
x ^ y
is bitwise xorx >> y
is bitwise rightx << y
is bitwise leftx & y
is bitwise andx \ y
is bitwise or~ x
is bitwise notbitSize(x)
(Everscale only) computes the smallest c ≥ 0 such that x fits into a c-bit signed integer (−2c−1 ≤ x < 2c−1).uBitSize(x)
(Everscale only) uBitSize computes the smallest c ≥ 0 such that x fits into a c-bit unsigned integer (0 ≤ x < 2c).
booleanean operations x || y
, x && y
and !x
have standart semantic
Math operations:
math->muldiv(x, y, z)
is syntax sugar for(x * y) / z
expressionmath->muldivmod(x, y, z)
is syntax sugar for[ (x * y) / z, (x * y) % z ]
min(x, y)
ormath->min(x, y)
is standart math minimum function with standart semanticmax(x, y)
ormath->max(x, y)
is standart math max function with standart semanticmath->abs(x)
is absolute function, which returns result with the same type asx