BitShiftLeft - Shift all bits in a LONG value to the left

Top  Previous  Next

Syntax

<nReturnValue> := BitShiftLeft( <nValLong>, <nBitShiftCount> )

Parameters

<nValLong>

 

A LONG value containing the bit pattern to be shifted left by the number of bits indicated in <nBitShiftCount>.

 

<nBitShiftCount>

 

A signed value indicating the number of bits to shift <nValLong> left. A negative number results in a bit shift to the right. The edge bits not assigned by the shift are filled with zeroes.

Return value

The resulting value of the shift operation.

Description

BitShiftLeft executes a bit shift left on <nValLong>. <nValLong> must contain a LONG value. The return value is a LONG value. This function is used when the shift macros  (a << b)  or (a >> b) are  expanded.

Classification

Core

Category

Bit manipulation

Quick Info

Library: cckptcor.lib / cckptcor.dll

See also

<<, >>, BitShiftMaskSign

Example

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "cmacros.ch"

 

FUNCTION Main

 

* This will output the values 16 and 1.

? BitShiftLeft(1,4)

? BitShiftLeft(16,-4)

 

* This can be also be written using the C syntax:

? (1<<4)

? (16>>4)

 

RETURN NIL