Operators: ~

Bitwise NOT operator.

Syntax

~integer‑operand

Unary bitwise complement

The operator results in a bitwise complement of a signed integer or unsigned integer operand: each 0 bit of the operand is set to 1, and each 1 bit is set to 0. The result of the operation is always an uint32 value. For example:

var uint32 a = 0xAAAAAAAA; var int16 b = 4032; // b = 0x0FC0 var uint32 result = ~a; // result = 0x55555555 var uint32 result = ~b; // result = 0xFFFFF03F