diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-10 21:32:50 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-10 23:49:25 +0200 |
commit | 13aacae3ac6afc8437f84527d0b5f564d7558cd1 (patch) | |
tree | 9accb25b77e4f2e40dd828ce5d9823b6a2ad37fe /crawl-ref/source/bitary.h | |
parent | 370d19ae9228843151b2d4dc56e549274040b991 (diff) | |
download | crawl-ref-13aacae3ac6afc8437f84527d0b5f564d7558cd1.tar.gz crawl-ref-13aacae3ac6afc8437f84527d0b5f564d7558cd1.zip |
Implement bit array class.
Diffstat (limited to 'crawl-ref/source/bitary.h')
-rw-r--r-- | crawl-ref/source/bitary.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h new file mode 100644 index 0000000000..110a9e846c --- /dev/null +++ b/crawl-ref/source/bitary.h @@ -0,0 +1,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 + |