BitwiseNOT

Description

Allows you to get the bitwise complement of a binary number.

Syntax

BitwiseNOT ( val1 )

Argument

Description

val1

Unsigned long for the binary number for which you want to get the bitwise complement

Returns

UnsignedLong. Returns the result of a bitwise complement for the val1 binary value. If val1 is null, BitwiseNOT returns null.

Usage

The BitwiseNOT function produces the bitwise complement of its sole operand. For each bit of the operand with a value of 1, the corresponding result bit is set to 0, and for each bit with a value of 0, the corresponding result bit is set to 1. BitwiseNOT resets the bits in all 32 positions for an unsigned long value in PocketBuilder.

Use hexadecimal formatting for capturing the return value.

Examples

Example 1

This example returns the bitwise complement of the binary value of the testValue variable:

UnsignedLong ll_result

ll_result = BitwiseNOT(testValue)

In this example, if the testValue variable has a hexadecimal value of 0x10 (or a decimal value of 16), it has a bit set in its fifth position only. For this value, BitwiseNOT returns a binary number with set bits in all but the fifth position. This corresponds to a hexadecimal value of 0xffffffef , or a decimal value 4,294,967,279.

See also