Provides a class to manipulate and store boolean arrays.
The bit-array is 0-based.
NB: There are 8 bit are in a byte. If the length is not a multiple of 8, the bits after length are unefined.
Methods
- init($l,$default=false)
- Creates the bitmap of length l, filled with default value./dd>
- redim($l,$default=false)
- Makes the bitmap longer (can only grow), filled with default value./dd>
- hexit()
- Converts $map to to $maphex and sets $map to empty string (both cannot coexist)./dd>
- dehexit()
- Converts $maphex to to $map and sets $maphex to empty string (both cannot coexist)./dd>
- save()
- /dd>
- open()
- /dd>
- setbit($n)
- Sets the nth bit to true. If n is bigger than or equal to length, the bitmap will be resized with default value./dd>
- unsetbit($n)
- Sets the nth bit to false. If n is bigger than or equal to length, the bitmap will be resized with default value./dd>
- getbit($n)
- Sets the nth bit to false. If n is bigger than or equal to length, the default value will be returned./dd>
- duplicate()
- Creates a real copy./dd>
- andop($bitmap)
- Returns a new bitmap with the value C = A AND B./dd>
- orop($bitmap)
- Returns a new bitmap with the value C = A OR B./dd>
- notop()
- Returns a new bitmap with the value B = NOT A./dd>
- dump()
- Returns a readable bitmap, grouped by 8 bits./dd>
- countbits()
- Returns the number of bits that are true./dd>
- toarray()
- Returns an array of all true bits./dd>
Properties
- $length
- Number of bits
- $touched
- Bitmap has been modified since open
- $map
- Binary bitmap data
- $maphex
- Human readable bitmap data
- $compressionmode
- If set, consecutive values in hex data are further compressed (letters g, h, i, j for 0, p, q, r, s for 1)
- $default
- Default value if setbit makes the bitmap longer
Functions
bitmapUnitTest()
Used elements
Classes
swBitmap
Functions
bitmapUnitTest
Variables
$bitmap, $bitmask, $byte, $bytes, $default, $dump, $list, $list2, $oldlength, $result, $xormapShort variables: $b1, $b2, $b3, $bit, $c, $ch, $i, $j, $l, $mod, $n, $r, $s, $t, $v
Features
array, math, misc, str, string, variable
Tokens
T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG