[Next] [Previous] [Top]

"RTL Grammar"

6 Unary and Binary Operators


These are the unary and binary operators currently defined. For many operators, versions exist for different operand types, such as +_int, +_unsigned_int, +_int8, +_unsigned_int8. Such families of operators are notated in the table using brace-delimited lists over the possible types, such as +_{int,unsigned_int,int8,unsigned_int8}.

unop name

description

unary_-_{int,int8,
         float,double}

{integer, 8-byte integer, float, double} negation

~_{int,int8}

{integer, 8-byte integer} bitwise complement

num_elems_int

extract the number of elements of an array, vector, or string object.

box_{int,char,
     float,double}

convert an untagged machine {integer, integer, float, double} into a tagged Cecil {integer, character, float, double} OOP

unbox_{int,char,
       float,double}

inverse of box_{int,char,float,double}

map_of

returns the CecilMap* pointer representing the run-time class of the argument; may be used as the argument to inherits_from

binop name

description

+_{int,unsigned_int,
   int8,unsigned_int8}

Add two {signed integers, unsigned integers, signed 8-byte integers, unsigned 8-byte-integers}

-_{int,unsigned_int,
   int8,unsigned_int8}

Subtract ...

*_{int,unsigned_int,
   int8,unsigned_int8}

Multiply ...

/_{int,unsigned_int,
   int8,unsigned_int8}

Divide ...

%_{int,unsigned_int,

   int8,unsigned_int8}

Modulus ...

&_{int,unsigned_int,
   int8,unsigned_int8}

Bitwise and two {signed integers, unsigned integers, 8-byte-integers, unsigned 8-byte integers}

|_{int,unsigned_int,
   int8,unsigned_int8}

... or ...

^_{int,unsigned_int,
   int8,unsigned_int8}

... xor ...

xnor_{int,unsigned_int,
      int8,
      unsigned_int8}

... xnor ...

<<_{int,unsigned_int,
    int8,unsigned_int8}

bitwise left shift one {signed integer, unsigned integer, 8-byte-integer, unsigned 8-byte integer} by another

>>_{int,unsigned_int,
    int8,unsigned_int8}

... arithmetic right shift ...

>>_logical_{int,int8}

... logical right shift ...

+_ptr

Add two values, one of which is assumed to be a pointer and the other an integer byte count, to produce a new pointer

-_ptr

Subtract an integer byte count from a pointer to produce a new pointer

-_ptrdiff

Subtract two pointers to produce an integer difference, in bytes

+_{float,double}

Add two {floats, doubles}

-_{float,double}

Subtract ...

*_{float,double}

Multiply ...

/_{float,double}

Divide ...

=_{int,unsigned,int8,
   unsigned_int8}_log

Test whether two {signed integers, unsigned integers, 8-byte-integers, unsigned 8-byte integers} are equal

!=_{int,unsigned,int8,
    unsigned_int8}_log

... not equal

>_{int,unsigned,int8,
   unsigned_int8}_log

Test whether one {signed integer, unsigned integer, 8-byte-integer, unsigned 8-byte integer} is greater than another

>=_{int,unsigned,int8,
    unsigned_int8}_log

... greater than or equal to ...

<_{int,unsigned,int8,
   unsigned_int8}_log

... less than ...

<=_{int,unsigned,int8,
    unsigned_int8}_log

... less than or equal to ...

=_ptr_log

Test whether two pointers are equal

!=_ptr_log

... not equal

>_ptr_log

Test whether one pointer is greater than another

>=_ptr_log

... greater than or equal to ...

<_ptr_log

... less than ...

<=_ptr_log

... less than or equal to ...

=_{float,double}_log

Test whether two {floats, doubles} are equal

!=_{float,double}_log

... not equal

>_{float,double}_log

Test whether one {float, double} is greater than another

>=_{float,double}_log

... greater than or equal to ...

<_{float,double}_log

... less than ...

<=_{float,double}_log

... less than or equal to ...