Bitwise Operations Overview

About Bitwise Operations

GCBASIC (as with most other microcontroller programming languages) supports bitwise operations.

Bitwise operations are performed on one or more bit patterns at the level of their individual bits.

GCBASIC supports the following methods.

Method Meaning

Set

Assigns a Bit value of On or Off

SetWith

Evaluates an expression and assigns the result

Rotate

Performs a rotation of a variable of one bit in a specified direction

Shift

Performs a logical shift of a variable of one bit in a specified direction, shifting in a 0. Faster than FnLSL and FnLSR for a shift of one place or a few places

FnLSL

Performs a Bitwise LEFT shift by any number of places. For one place, or a few, Shift is faster

FnLSR

Performs a Bitwise RIGHT shift by any number of places. For one place, or a few, Shift is faster

For more help, see: Set, SetWith, Rotate, Shift, FnLSL and FnLSR