xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_BitNot()

Performs a bitwise NOT operation with a numeric integer value.

Syntax

HB_BitNot( <nInteger> ) --> nResult

Arguments

<nInteger>
A numeric integer value must be passed. If a number with decimal fraction or a value of other data types is specified, a runtime error is generated. Function Int() can be used to make sure the parameter is an integer value.

Return

The function returns a numeric value. It is the result of the bitwise NOT operation with the bits of the parameter.

Description

The function performs bitwise NOT operation with the bits of the passed parameter. That is, all bits are inverted.

Info

See also:HB_BitAnd(), HB_BitIsSet(), HB_BitOr(), HB_BitXOr()
Category: Bitwise functions , xHarbour extensions
Source:rtl\hbBitf.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows the result of a bitwise NOT operation

   PROCEDURE Main
      LOCAL i

      FOR i := -5 TO 5
         ? i, HB_BitNot(i)
      NEXT

      ** Output
      //        -5          4
      //        -4          3
      //        -3          2
      //        -2          1
      //        -1          0
      //         0         -1
      //         1         -2
      //         2         -3
      //         3         -4
      //         4         -5
      //         5         -6
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe