VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "BitArray"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private BitArray() As Byte
Private theBit As Boolean
Private BitLookup(7) As Byte
Private BitComplement(7) As Byte
Private I As Long
Private Sub Class_Initialize()
  For I = 1 To 7
    BitLookup(I) = 2 ^ (I - 1)
    BitComplement(I) = 255 - BitLookup(I)
  Next I
  BitLookup(0) = 2 ^ 7
  BitComplement(0) = 255 - BitLookup(0)
  
End Sub
Public Property Let BitSet(N As Long)
  ReDim BitArray(((N - 1) \ 8) + 1)
End Property
Function BitValue(N As Long) As Byte
 BitValue = BitLookup(N Mod 8)
End Function
Function BitComplementValue(N As Long) As Byte
 BitComplementValue = BitComplement(N Mod 8)
End Function
Public Property Get getBit(N As Long) As Boolean
 getBit = BitArray(N \ 8) And BitValue(N)
End Property
Public Property Let turnOffBit(N As Long)
  BitArray(N \ 8) = BitArray(N \ 8) And BitComplementValue(N)
End Property
Public Property Let turnOnBit(N As Long)
  BitArray(N \ 8) = BitArray(N \ 8) Or BitValue(N)
End Property
