Topic complex |
Array functions |
Function |
bitnot() |
Short |
Complement of a Bit array |
Syntax |
BITNOT(VAR M : TBITS[]) : INTEGER |
Parameter |
M : TBITS[] |
Return |
NBITS(M) after operation (= cardinality of M) |
See also: |
|
Description |
M is understood as a function of a (sub-)set. After execution of the function M has the characteristical function of the complement of this set (i.e. every Bit is inverted).
|
Example 1: BitNot + BitTrunc
VAR x : TBITS[]
InitArray(x[3])
BitSum(x) // = 0 <> bits 000[00000]
BitNot(x)
BitSum(x) // = 8 <> bits 111[11111]
BitTrunc(x,3 +1)
BitSum(x) // = 3 <> bits 111[00000]
|
Example 2: BitNot + BitTrunc 2
Sets a bit for each record of db
var x : TBits[]
InitArray(x[FileSize(db)];
BitNot(x);x[0]:=0; BitTrunc(x,FileSize(db)+1)
|
Write a comment:
|