struct BitArray

Overview

Seriously, what's the fun of having a BitArray type in Crystal's stdlib if you can't even do bitwise operations on them?! We'll have our fun here.

Included Modules

Defined in:

savi/ext/bit_array.cr

Instance Method Summary

Instance Method Detail

def |(other : BitArray) : BitArray #

Return a new BitArray whose bits are the union of those in self and other. Raises an ArgumentError if the two BitArrays are not the same size.


[View source]
def intersection?(other : BitArray) : BitArray | Nil #

Return a BitArray containing those bits that are in both self and other, or nil if there are no bits that intersect between the two. Raises an ArgumentError if the two BitArrays are not the same size. There are easier ways to do this, but we want to optimize for not producing a new BitArray unless it is absolutely necessary.


[View source]