Reviewed and revised April 2024
xcall BITOPS, opcode, chfld, pos, result, result2
BITOPS was developed to facilitate the use of large bit fields (bitmaps). These are quite useful when you want to keep a single binary flag for each of many items. The bit field can be held in memory in a variable of type X, or in a random file.
Parameters
opcode (Num) [in]
specifies the operation using the following values:
Value |
Meaning |
---|---|
1 |
Clear bit #<pos>; if <pos> = -1 or is omitted, clear all bits in bitmap |
2 |
Set bit #<pos>; if <pos> = -1 or is omitted, set all bits in bitmap |
3 |
Counts all bits in bitmap; return number of 0s in result, number of 1s in result2 |
4 |
Set result to bit number of first zero bit on or after given pos. If no more zero bits, return –1. At same time, set result2 to bit number of first one bit on or after pos. |
chfld (BLOB or Unsigned Int) [in]
is either the bit field (if type X) of any size (first bit is considered bit #0); if any type other than X, chfld is interpreted as an open random file channel (containing the bit field).
pos (Num) [in]
specifies the bit number we are operating on or starting from; see opcode table above.
result, result2 (Num) [out]
are used to return the results; see opcode table above.