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:

  1. x + y standart sum with number overflow:
    1. x and y has uint or int type
    2. if one of the term has type uint and another has int, result will be int
    3. if one of the term has type uintN and another has uintM (N >= M), result will be uintN
  2. functions x - y, x * y have the as same logic as the previous ones

TODO comparing addresses

  1. functions x == y, x != y work with boleans and nums, functions x < y, x <= y, x > y, x >= y works with nums. All of these functions have standart semanthic.
  2. x / y standart division operation, but if at least one of the term is zero the result will be zero too
  3. x % y standart modulo operation, but if x is zero then result will be zero too

Bitwise operations:

  1. x ^ y is bitwise xor
  2. x >> y is bitwise right
  3. x << y is bitwise left
  4. x & y is bitwise and
  5. x \ y is bitwise or
  6. ~ x is bitwise not
  7. bitSize(x) (Everscale only) computes the smallest c ≥ 0 such that x fits into a c-bit signed integer (−2c−1 ≤ x < 2c−1).
  8. 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:

  1. math->muldiv(x, y, z) is syntax sugar for (x * y) / z expression
  2. math->muldivmod(x, y, z) is syntax sugar for [ (x * y) / z, (x * y) % z ]
  3. min(x, y) or math->min(x, y) is standart math minimum function with standart semantic
  4. max(x, y) or math->max(x, y) is standart math max function with standart semantic
  5. math->abs(x) is absolute function, which returns result with the same type as x