Click or drag to resize

BitTest Function (Long, Long)

X#
Determines whether a specific bit in a Numeric, Varbinary, or Blob value is set to 1. There is a numeric and a binary version of the syntax. If the specified expression is not an integer, it is converted to an integer before performing the operation.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION BitTest(
	Arg AS LONG,
	Bit AS LONG
) AS LOGIC
Request Example View Source

Parameters

Arg
Type: Long
Specifies the Numeric value to check for the specified bit.
Bit
Type: Long
Specifies the bit position in nExpression1 to check. nExpression2 can range from 0 to 31 with 0 as the bit farthest to the right.

Return Value

Type: Logic
Logical. BitTest( ) returns True (.T.) if the specified bit is set to 1; otherwise, it returns False (.F.).
Examples
X#
 1Clear
 2? '2 even? '
 3?? IsEven(2)  // Even, .T. returned
 4? '3 even? '
 5?? IsEven(3)  // Not even, .F. returned
 6? '0 even? '
 7?? IsEven(0)  // Even, .T. returned
 8? '-13 even? '
 9?? IsEven(-13)  // Not even, .F. returned
10Function IsEven
11PARAMETER nInteger
12RETURN NOT BitTest(nInteger, 0)
See Also