| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Performs a bitwise XOR operation with two numeric 32-bit integer values.
NumXOR( <nInteger1>|<cHex1>, ;
<nInteger2>|<cHex2> ) --> nInteger
The function returns the result of an exclusive OR operation with the bits of both parameters as a numeric value. The bits are set in the result where the bits of both parameters are different.
| See also: | IsBit(), NumAND(), NumNOT(), NumOR(), NumXorX(), SetBit() |
| Category: | CT:NumBits , Bitwise functions , Numbers and Bits |
| Source: | ct\bit1.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays the results of exclusive OR operations and
// their binary representation.
PROCEDURE Main
LOCAL nValue1 := 6
LOCAL nValue2 := 23
LOCAL nResult
? NtoC( nValue1, 2, 8, "0" ) // result: 00000110
? NtoC( nValue2, 2, 8, "0" ) // result: 00010111
nResult := NumXOR( nValue1, nValue2 )
? nResult // result: 17
? NtoC( nResult, 2, 8, "0" ) // result: 00010001
nResult := NumXOR( nValue1, nResult )
? nResult // result: 23
? NtoC( nResult, 2, 8, "0" ) // result: 00010111
? nResult == nValue2 // result: .T.
RETURN
http://www.xHarbour.com