UnsignedIntegerBinOp

An arithmetic or bitwise operation on unsigned integers.

Declaración

Sintaxis

UnsignedIntegerBinOp(expr left, binop op, expr right, ttype type,
    expr? value)

Argumentos

Argument

Descripción

left

the left operand.

op

the operator; see binop.

right

the right operand.

type

the type of the expression.

value

the compile time value of the expression, when the frontend could fold it; nil otherwise.

Valores devueltos

The value of the expression.

Descripción

The unsigned counterpart of IntegerBinOp. Division and the right shift differ from the signed operations, which is why the two cannot share a node.

Ejemplos

(UnsignedIntegerBinOp
  :left (Var
    :v (SymbolRef 1 "u")
  )
  :op :Add
  :right (UnsignedIntegerConstant
    :n 1
    :type (UnsignedInteger
      :kind 4
    )
  )
  :type (UnsignedInteger
    :kind 4
  )
  :value nil
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "b" (Variable
              :parent_symtab 1
              :name "b"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Logical
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "u" (Variable
              :parent_symtab 1
              :name "u"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (UnsignedInteger
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "v" (Variable
              :parent_symtab 1
              :name "v"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (UnsignedInteger
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (Assignment
            :target (Var
              :v (SymbolRef 1 "u")
            )
            :value (UnsignedIntegerConstant
              :n 7
              :type (UnsignedInteger
                :kind 4
              )
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "v")
            )
            :value (UnsignedIntegerBinOp
              :left (Var
                :v (SymbolRef 1 "u")
              )
              :op :Add
              :right (UnsignedIntegerConstant
                :n 1
                :type (UnsignedInteger
                  :kind 4
                )
              )
              :type (UnsignedInteger
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "v")
            )
            :value (UnsignedIntegerUnaryMinus
              :arg (Var
                :v (SymbolRef 1 "u")
              )
              :type (UnsignedInteger
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "v")
            )
            :value (UnsignedIntegerBitNot
              :arg (Var
                :v (SymbolRef 1 "u")
              )
              :type (UnsignedInteger
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "b")
            )
            :value (UnsignedIntegerCompare
              :left (Var
                :v (SymbolRef 1 "u")
              )
              :op :Gt
              :right (Var
                :v (SymbolRef 1 "v")
              )
              :type (Logical
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
        ]
      )
    }
  )
  :items []
)

Ver también

IntegerBinOp, UnsignedIntegerCompare, UnsignedInteger