src/nimcso/bitArrayAutoconfigured

Source   Edit  

Navigation: nimCSO (core library) | Changelog | nimcso/bitArrayAutoconfigured

Types

BitArray = object
  bits*: array[lenInt64, uint64]
Creates an array of bits all packed in together. Source   Edit  

Consts

lenInt64 = 1
Compile-time constant of the number of uint64 in the array used to store elements in the BitArray. Source   Edit  

Procs

func `$`(b: BitArray): string {....raises: [], tags: [], forbids: [].}
Returns a string representation of the BitArray as a string of 0s and 1s. Source   Edit  
func `==`(a, b: var BitArray): bool {....raises: [], tags: [], forbids: [].}
Checks equality of two BitArrays by comparing unit64 values in their bits fields. Source   Edit  
func `[]`(b: BitArray; i: int): bool {....raises: [], tags: [], forbids: [].}
Access a single bit of the BitArray at position i, with bounds checking. Source   Edit  
func `[]=`(b: var BitArray; i: int; v: bool) {....raises: [], tags: [], forbids: [].}
Source   Edit  
func `and`(a, b: BitArray): BitArray {....raises: [], tags: [], forbids: [].}
Applies AND over all positions of two BitArrays returning a new BitArray. Source   Edit  
func clear(b: var BitArray) {....raises: [], tags: [], forbids: [].}
Unsets all of the bits in the BitArray. Source   Edit  
func count(b: BitArray): int {....raises: [], tags: [], forbids: [].}
Returns the number of set bits in the BitArray. Source   Edit  
func firstFalse(b: BitArray): (bool, int) {....raises: [], tags: [], forbids: [].}
Returns the value and position of the first false bit in BitArray. Source   Edit  
func hash(b: BitArray): Hash {....raises: [], tags: [], forbids: [].}
Computes a Hash for the BitArray by hasing the array of uint64s. Source   Edit  
func `not`(a: BitArray): BitArray {....raises: [], tags: [], forbids: [].}
Applies NOT over all positions of a BitArray returning a new BitArray. Source   Edit  
func `or`(a, b: BitArray): BitArray {....raises: [], tags: [], forbids: [].}
Applies OR over all positions of two BitArrays returning a new BitArray. Source   Edit  
proc styledEcho(b: BitArray) {....raises: [IOError, ValueError],
                               tags: [WriteIOEffect], forbids: [].}
Prints the BitArray in a stylish way, with 1s in bright green and 0s in dim red. Source   Edit  
proc styledEchoAnnotated(b: BitArray) {....raises: [IOError, ValueError],
                                        tags: [WriteIOEffect], forbids: [].}
Prints the BitArray in a stylish way, with (1) top annotation of the index like | 0| 1| 2| ... |10|11| ..., (2) side annotation of the lenght of the array, and (3) 1s in bright green and 0s in dim red. Source   Edit  
func toBoolArray(b: BitArray): array[elementN, bool] {....raises: [], tags: [],
    forbids: [].}
Converts the BitArray to an array of bools. Source   Edit  
func toSetPositions(b: BitArray): seq[int] {....raises: [], tags: [], forbids: [].}
Converts the BitArray to a sequence of positions of the true bits. Source   Edit  
func unsafeGet(b: BitArray; i: int): bool {....raises: [], tags: [], forbids: [].}
Access a single bit (unchecked) of the BitArray at position i. Source   Edit  
func unsafeSetFalse(b: var BitArray; i: int) {....raises: [], tags: [], forbids: [].}
Set a single bit to false (unchecked) of the BitArray at position i. Source   Edit  
func unsafeSetTrue(b: var BitArray; i: int) {....raises: [], tags: [], forbids: [].}
Set a single bit to true (unchecked) of the BitArray at position i. Source   Edit  

Iterators

iterator items(b: BitArray): bool {....raises: [], tags: [], forbids: [].}
Iterates over the bits of the BitArray yielding true or false. Source   Edit  
iterator pairs(b: BitArray): (int, bool) {....raises: [], tags: [], forbids: [].}
Iterates over the bits of the BitArray yielding the position and the true or false value. Source   Edit