## Logical and Bit-Operators

### AND

This operator is used to perform a logical comparison of two expression. It is always performed a bitwise combination of the two expressions.

*Result = Expression1 AND Expression2*

#### Example

This example combinate different values bitwise „AND“:

dim x as integer x = 9 and 3

### OR

This operator is used to perform a logical OR-comparison of two expressions. It is always performed a bitwise combination of the two expressions.
*Result = Expression1 OR Expression2*

#### Example

This example combinate different values bitwise „OR“:

dim x as integer x = 9 or 3

### XOR

This operator is used to perform a logical Exclusive-OR comparison of two expressions. It is always performed a bitwise combination of the two expressions.
*Result = Expression1 XOR Expression2*

#### Example

This example combinate different values bitwise „XOR“:

dim x as integer x = 9 xor 3

### NOT

This operator is used to perform a logical negation of a expression **in conditions**.
In other Expressions, e.g. **if assigned as parameter**, the **„ones complement“**.

*Result = NOT Expression*

#### Example

This example performs a bitwise negation:

dim x as integer x = not 33 ' Ones complement of 33

### <<

This operator is used to shift x bits left. The argument right from the operator is the number of bits. The number of bits can be a expression or variable. **Warning with signed values! This operation shifts all bits. For signed values use the arithmetical bit-shift asl().**

*Result = Value << numBits*

#### Example

' in Expressions a = &b10000001 var = a << 3 ' shifts the value &b10000001 3 bits left to &b00001000 ' in assembler source asm ldi R16,(1 << 3) endasm

### >>

This operator is used to shift x bits right. The argument right from the operator is the number of bits. The number of bits can be a expression or variable. **Warning with signed values! This operation shifts all bits. For signed values use the arithmetical bit-shift asr().**

*Result = Value >> numBits*

#### Example

' in Expressions a = &b10001000 var = a >> 3 ' shifts the value &b10001000 3 bits right ro &b00010001 ' in assembler source asm ldi R16,(&b10000000 >> 3) endasm

### <<<

Implemented in version | 2013.r2 |
---|

This operator is used to rotate the Value x bits left. The argument right from the operator is the number of bits. The number of bits can be a expression or variable. **Warning with signed values! This operation rotates all bits. The sign-state of signed and negative values are destroyed.**

*Result = Value <<< numBits*

**Note:** Operator not available in the preprocessor.

#### Example

' in Expressions a = &b10000001 var = a <<< 1 ' rotates the value &b10000001 1 bit left to &b00000011

### >>>

Implemented in version | 2013.r2 |
---|

This operator is used to perform a Wert um x Bits nach rechts zu rotieren (Rotate-Right). The argument right from the operator is the number of bits. The number of bits can be a expression or variable. **Warning with signed values! This operation rotates all bits. The sign-state of signed and negative values are destroyed.**

*Result = Value >>> numBits*

**Note:** Operator not available in the preprocessor.

#### Example

' im Expression a = &b00000011 var = a >>> 1 ' rotates the value &b00000011 1 bit right to &b10000001