BITWISE

This module allows you to perform logical and bitwise operations with numbers.

Special thanks to Pesekjak for creating the Bitshift addon. The implementation of binary operations and the concept of bitwise shifts were inspired by their work.

Binary operation OR

Copies a bit to the result if it exists in both operands.

%number% | %number%

Logical operation OR

If at least one is True, then the truth will be returned.

%boolean% || %boolean%

Binary operation AND

Copies a bit if it exists in any of the operands.

%number% & %number%

Logical operation AND

If both operands are True, then true will be returned.

%boolean% && %boolean%

Binary operation XOR

Copies a bit if it is set in one operand, but not in both.

%number% ^^ %number%

Bitwise shift to the left

The value of the left operands moves to the left by the number of bits specified by the right operand.

%number% << %number%

Bitwise shift to the right

The value of the right operands moves to the right by the number of bits specified by the left operand.

%number% >> %number%

Bitwise zero shift to the right

The value of the left operands is moved to the right by the number of bits specified by the right operand, and the shifted values are filled with zeros.

%number% >>> %number%

Binary complement operation (reflection)

Each bit of the number will be inverted.

~%number%

A number in binary notation

0(b|B)<[0-1]+>
set {_binary} to 0b22

A number in the hexadecimal system

0(x|X)<[A-Fa-f0-9]+>
set {_hexadecimal} to 0xFF