%BIT_IS_CLR
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
status = %BIT_IS_CLR(bit, value)
Return value
status
One of the following values: (n)
1 = The bit is clear.
0 = The bit is set.
Arguments
bit
The number of the bit to be evaluated. (n)
value
The value whose binary representation contains the bit to be evaluated. (n)
Discussion
%BIT_IS_CLR evaluates a bit value in the binary representation of a value.
Bit numbering is zero-based. Bit can be 0 through 63 (or 31 on 32-bit systems), corresponding to values 1 through 8000000000000000 (hexadecimal).
We recommend using bitwise Boolean operators rather than the %BIT_IS_CLR and %BIT_IS_SET functions. |
See also
Examples
The following example evaluates bit number 2 in the binary representation of 20:
%bit_is_clr(2,20)
Since the binary representation of 20 is 10100, and bit number 2 is actually the third bit from the right, this call to %BIT_IS_CLR returns a value of zero.
The example below translates bit flags and displays their values to the terminal.
subroutine show_bflags” a_bit_flags ,n ;Bit positions .define PUBLIC_BIT ,4 .define DOMESTIC_BIT ,5 .define LESS50_BIT ,6 .define VMAIL_BIT ,7 proc xcall showit("Public company?", & %bit_is_clr(PUBLIC_BIT, a_bit_flags)) xcall showit("Domestic sales only?", & %bit_is_clr(DOMESTIC_BIT, a_bit_flags)) xcall showit("Less than 50 employees?", & %bit_is_clr(LESS50_BIT, a_bit_flags)) xcall showit("Voice mail system?", & %bit_is_clr(VMAIL_BIT, a_bit_flags)) return endsubroutine subroutine showit a_txt ,a ;Text to display a_set ,n ;1 = set, 0 = not set record yn ,a1 ;Y or N proc if (a_set) then yn = 'N' else yn = 'Y' display(TTCHN, a_txt, " (Y/N) ", yn) return endsubroutine