Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>test() - test bits in a number</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     test() - test bits in a number
  Usage:    <logical> = test(<int>,<number>)
  Params:   integer <int> - number to test, not greater then 65535
            integer <number> number to test against <int>
  Returns:  .T. if bit specified by <number> is set to 1 in
            parameter <int>,  otherwise .F.

 ---------------------------------- Example ---------------------------------

                 ? test(1,1)         && prints .T.
                 ? test(1,0)         && prints .F.
                 ? test(15,3)        && prints .T.
                 ? test(245,8)       && prints .T.

  Note:     Testing one value with another will return .T. only
            if the bit specified in param two (<number>) is set to
            one in param one (<int>).

                 parameter = binary       = dec
                 v1        = 00000010     = 2
                 v2        = 00000010     = 2
                 v3        = 00100000     = 32

                 ? test(v1,v2) = .T.
                 ? test(v1,v3) = .F.

            You can use num2bin() and bin2num() to convert
            binary strings into their decimal equivalents for ease
            when using the binary functions.


See Also: and() or() ror() xor() shl() shr()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson