BitNot - Invert all bits of a LONG value

Top  Previous  Next

Syntax

<nReturnValue> := BitNot( <nVal> )

Parameters

<nVal>

 

A numeric parameter containing a LONG value to be used in the binary NOT operation.

Return value

The result of the binary inversion of <nVal>.

Description

BitNot executes a binary NOT operation (32 bits wide) on the parameter passed. The parameter must contain a LONG value. The return value is a  LONG value with those bits set to 1 which were 0 in <nVal> and those bits set to 0 that were 1 in <nVal>. This function is used when the macro ~a is expanded.

Classification

Core

Category

Bit manipulation

Quick Info

Library: cckptcor.lib / cckptcor.dll

See also

~, BitAnd, BitOr, BitXor

Example

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "cmacros.ch"

 

FUNCTION Main

 

* This will output the value 1

? BitNot(-2)  

 

* This is the equivalent in (almost) C syntax supported by Cockpit

? ~ -2

 

RETURN NIL