BitwiseShiftLeft

Description

Allows you to modify a binary number by shifting all its bits to the left by a specified amount.

Syntax

BitwiseShiftLeft ( val, shift_amount)

Argument

Description

val

Unsigned long for the binary number you want to modify

shift_amount

Unsigned integer for the number of places you want to shift the bits of a binary number

Returns

UnsignedLong. Returns the result for a binary number when its bits are shifted to the left by the amount specified in the shift_amount argument. If one of its arguments is null, BitwiseShiftLeft returns null.

Usage

In PocketBuilder there are 32 bits in an unsigned long. If you enter 31 or greater for shift_amount, PocketBuilder fires the runtime SystemError event because the value is out of range.

Examples

Example 1

This example shifts the bits in testValue two places to the left:

UnsignedLong ll_result

ll_result = BitwiseShiftLeft(testValue, 2)

In this example, when testValue is 10, its binary equivalent has positive bits in the second and fourth positions. If you shift the bits two places to the left, the resulting number is 40, with positive bits in the fourth and sixth positions.

See also