xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

NumMirr()

Mirrors 8 or 16 bits of a 16-bit integer.

Syntax

NumMirr( <nInteger>|<cHex>, ;
        [<lEightBits>]      ) --> nInteger

Arguments

<nInteger>
A numeric 16-bit integer value in the range between 0 and 65535 can be specified as first parameter.
<cHex>
Alternatively, the integer can be passed as a hex-encoded character string (see NumToHex()).
<lEightBits>
If .T. (true) is passed for <lEightBits>, only the low 8 bits of <nInteger> are mirrored. The default value is .F. (false), i.e. all 16 bits are mirrored.

Return

The function returns a numeric integer value with 16 or 8 bits set in reversed order.

Info

See also:NumAND(), NumHigh(), NumLow(), NumMirrX(), NumNOT(), NumOR(), NumRoL()
Category: CT:NumBits , Numbers and Bits
Source:ct\bit1.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays results of NumMirr() and their binary
// representation.

   PROCEDURE Main
      LOCAL nValue := 4209

      ? nValue                               // result:  4209
      ? NtoC( nValue, 2, 16, "0" )
                                  // result: 0001000001110001

      ? NumMirr( nValue )                    // result: 36360
      ? NtoC( NumMirr( nValue ), 2, 16, "0" )
                                  // result: 1000111000001000

      ? NumMirr( nValue, .T. )                // result: 4238
      ? NtoC( NumMirr( nValue, .T. ), 2, 16, "0" )
                                  // result: 0001000010001110
   RETURN

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