BitAnd - Execute a binary AND operation on a list of values

Top  Previous  Next

Syntax

<nReturnValue> := BitAnd( <nVal1>, <nVal2> {,<nValn>} )

Parameters

<nVal1..n>

 

Numeric parameters containing LONG values to be used in the binary AND operation.

Return value

The result of binary ANDing all parameters.

Description

BitAnd executes a binary AND operation (32 bits wide) with all parameters passed. All parameters must contain numeric LONG values. The return value is a LONG value with just those bits set to 1 which contained 1 in every parameter. This function is used when the macro (a & b) is expanded.

Classification

Core

Category

Bit manipulation

Quick Info

Library: cckptcor.lib / cckptcor.dll

See also

&, BitNot, BitOr, BitXor

Example

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "cmacros.ch"

 

FUNCTION Main

 

* This will output the value 1

? BitAnd(1,3,5)  

 

* This is the equivalent in C syntax supported by Cockpit

? (1 & 3 & 5)

 

RETURN NIL