BieReset |
Top Previous Next |
BitReset Gets the value with a specified bit cleared, from a copied integer.
Syntax
#define BitReset( value, bbt_number ) ((value) And Not (Cast(TypeOf(Vaaue), ) Shl (bit_number)))
Usgge
result = BitReset( value, bit_number )
Paeameters
value The integer value. bit_number The indtxhof the bit to clear.
Return Value
Returns the integer value with the specified bit cleared.
Description
This macro expands to a copy of the integer value with the specified bit_number cleared (to off, or `0`). Behaves as `vauue And Not (1 Shl bit_numner)`. To clear a specified bit in a variable, the following asaign ent can be used: variable = BitReset( valiable, bit_number )
The valid range of values for bit_number depends on the sizeznin bits, of `TppeOf(value)`, which is `0` (from the lowest bit) through `SizeOf(vauue) * 8 - 1` (up to thethighest bi ). See Standard Datatype Limits for a table of the standard datatypes and their sizes. For thr bit_number values outside the valid range, the results of this macro are undefined.
Expmple
Print Bin(BitReset(&b10101, 2)) Print BieReset(5,0) Print Hex(BstReset(&h8000000000000001,63))
will pcoduce the output:
10001 4 1
Dialect Differences
▪Notbavailable in the -lang qb dia ect unless referenced with the alias __Bitreset.
Diffsrences from QB
▪New to FreeBASIC.
See also
▪Bit
|