summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/bitary.h
blob: 110a9e846c0a53243f52f8af5e113bb67c5d9ac9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 *  File:         bitary.h
 *  Summary:      Bit array data type.
 *  Created by:   Robert Vollmert
 *
 * Just contains the operations required by los.cc
 * for the moment.
 */

#ifndef BITARY_H
#define BITARY_H

struct bit_array
{
public:
    bit_array(unsigned long size = 0);
    ~bit_array();

    void reset();

    bool get(unsigned long index) const;
    void set(unsigned long index, bool value = true);

    bit_array& operator |= (const bit_array& other);
    bit_array& operator &= (const bit_array& other);
    bit_array  operator & (const bit_array& other) const;

protected:
    unsigned long size;
    int nwords;
    unsigned long *data;
};

#endif