7.19 Unary operators

Unary operators return a string, numeric, or logical value. They have higher precedence than other operators and are evaluated first.

A unary operator precedes its operand. Adjacent operators are evaluated from right to left.
The following table lists the unary operators that return strings:

Table 7-1 Unary operators that return strings

Operator
Usage
Description
:CHR:
:CHR:A
Returns the character with ASCII code A.
:LOWERCASE: :LOWERCASE:string Returns the given string, with all uppercase characters converted to lowercase.
:REVERSE_CC: :REVERSE_CC:cond_code Returns the inverse of the condition code in cond_code, or an error if cond_code does not contain a valid condition code.
:STR:
:STR:A
Returns an 8-digit hexadecimal string corresponding to a numeric expression, or the string "T" or "F" if used on a logical expression.
:UPPERCASE: :UPPERCASE:string Returns the given string, with all lowercase characters converted to uppercase.
The following table lists the unary operators that return numeric values:

Table 7-2 Unary operators that return numeric or logical values

Operator Usage Description
?
?A
Number of bytes of code generated by line defining symbol A.
+ and -
+A
-A
Unary plus. Unary minus. + and – can act on numeric and PC-relative expressions.
:BASE:
:BASE:A
If A is a PC-relative or register-relative expression, :BASE: returns the number of its register component. :BASE: is most useful in macros.
:CC_ENCODING: :CC_ENCODING:cond_code Returns the numeric value of the condition code in cond_code, or an error if cond_code does not contain a valid condition code.
:DEF:
:DEF:A
{TRUE} if A is defined, otherwise {FALSE}.
:INDEX:
:INDEX:A
If A is a register-relative expression, :INDEX: returns the offset from that base register. :INDEX: is most useful in macros.
:LEN:
:LEN:A
Length of string A.
:LNOT:
:LNOT:A
Logical complement of A.
:NOT:
:NOT:A
Bitwise complement of A (~ is an alias, for example ~A).
:RCONST: :RCONST:Rn Number of register, 0-15 corresponding to R0-R15.
Related concepts
7.20 Binary operators
Non-ConfidentialPDF file icon PDF versionARM DUI0379G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.