Revision history for KeyPgBit
Additions:
PRINT BIT(&B1000, 3)
0
0
Deletions:
Additions:
For the ##//bit_number//## values outside the valid range, the results of this macro are undefined.
Additions:
The valid range of values for ##//bit_number//## depends on the size, in bits, of `##[[KeyPgTypeof|Typeof]](//value//)##`, which is `##0##` (from the lowest bit) through `##[[KeyPgSizeof|Sizeof]](//value//) * 8 - 1##` (up to the highest bit). See [[TblVarTypes|Standard Datatype Limits]] for a table of the standard datatypes and their sizes.
Deletions:
Revision [21588]
Edited on 2016-09-12 06:49:25 by fxm [Added the valid range of values for 'bit_number']Additions:
The valid range of values for ##//bit_number//## depends on the size, in bits, of `##[[KeyPgTypeof|Typeof]](//value//)##`, which is `##0##` through `##[[KeyPgSizeof|Sizeof]](//value//) * 8 - 1##`. See [[TblVarTypes|Standard Datatype Limits]] for a table of the standard datatypes and their sizes.
Additions:
[[KeyPgPpdefine|#define]] **Bit**( //value//, //bit_number// ) (((//value//) [[KeyPgOpAnd|and]] ([[KeyPgCast|Cast]]([[KeyPgTypeof|TypeOf]](//value//), 1) [[KeyPgOpShiftLeft|shl]] (//bit_number//))) <> 0)
Returns an ##[[KeyPgInteger|Integer]]## value of ##-1## if the bit is set, or ##0## if the bit is cleared.
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd|And]] 1 [[KeyPgOpShiftLeft|Shl]] //bit_number//) <> 0##`.
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Bit""**##.
- ##[[KeyPgBitset|Bitset]]##
- ##[[KeyPgBitreset|Bitreset]]##
Returns an ##[[KeyPgInteger|Integer]]## value of ##-1## if the bit is set, or ##0## if the bit is cleared.
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd|And]] 1 [[KeyPgOpShiftLeft|Shl]] //bit_number//) <> 0##`.
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Bit""**##.
- ##[[KeyPgBitset|Bitset]]##
- ##[[KeyPgBitreset|Bitreset]]##
Deletions:
Returns an ##[[KeyPgInteger Integer]]## value of ##-1## if the bit is set, or ##0## if the bit is cleared.
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd And]] 1 [[KeyPgOpShiftLeft Shl]] //bit_number//) <> 0##`.
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Bit""**##.
- ##[[KeyPgBitset Bitset]]##
- ##[[KeyPgBitreset Bitreset]]##
Additions:
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Bit""**##.
Deletions:
Additions:
[[KeyPgPpdefine #define]] **Bit**( //value//, //bit_number// ) (((//value//) [[KeyPgOpAnd and]] ([[KeyPgCast Cast]]([[KeyPgTypeof TypeOf]](//value//), 1) [[KeyPgOpShiftLeft shl]] (//bit_number//))) <> 0)
Deletions:
Additions:
//result// = **Bit**( //value//, //bit_number// )
Deletions:
Additions:
Returns an ##[[KeyPgInteger Integer]]## value of ##-1## if the bit is set, or ##0## if the bit is cleared.
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd And]] 1 [[KeyPgOpShiftLeft Shl]] //bit_number//) <> 0##`.
- New to ""FreeBASIC""
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd And]] 1 [[KeyPgOpShiftLeft Shl]] //bit_number//) <> 0##`.
- New to ""FreeBASIC""
Deletions:
This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##//value// [[KeyPgOpAnd And]] 1 [[KeyPgOpShiftLeft Shl]] //bit_number//##`.
- New to FreeBASIC