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 + ystandart sum with number overflow:xandyhas 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 * yhave the as same logic as the previous ones
TODO comparing addresses
- functions
x == y,x != ywork with boleans and nums, functionsx < y,x <= y,x > y,x >= yworks with nums. All of these functions have standart semanthic. x / ystandart division operation, but if at least one of the term is zero the result will be zero toox % ystandart modulo operation, but ifxis zero then result will be zero too
Bitwise operations:
x ^ yis bitwise xorx >> yis bitwise rightx << yis bitwise leftx & yis bitwise andx \ yis bitwise or~ xis 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) / zexpressionmath->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