UnsignedIntegerBitNot

Bitwise complement of an unsigned integer.

Declaration

Syntax

UnsignedIntegerBitNot(expr arg, ttype type, expr? value)

Arguments

Argument

Description

arg

the operand.

type

the type of the expression.

value

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

Return values

The value of the expression.

Description

Every bit of the operand is flipped.

Examples

(UnsignedIntegerBitNot
  :arg (Var
    :v (SymbolRef 1 "u")
  )
  :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 []
)

See Also

IntegerBitNot, UnsignedIntegerBinOp