UnsignedIntegerBinOp¶
An arithmetic or bitwise operation on unsigned integers.
Declaration¶
Syntax¶
UnsignedIntegerBinOp(expr left, binop op, expr right, ttype type,
expr? value)
Arguments¶
Argument |
Description |
|---|---|
|
the left operand. |
|
the operator; see binop. |
|
the right operand. |
|
the type of the expression. |
|
the compile time value of the expression, when the frontend could fold it; |
Return values¶
The value of the expression.
Description¶
The unsigned counterpart of IntegerBinOp. Division and the right shift differ from the signed operations, which is why the two cannot share a node.
Examples¶
(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 []
)