From 13aacae3ac6afc8437f84527d0b5f564d7558cd1 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 10 Oct 2009 21:32:50 +0200 Subject: Implement bit array class. --- crawl-ref/source/bitary.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 crawl-ref/source/bitary.h (limited to 'crawl-ref/source/bitary.h') 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 + -- cgit v1.2.3-54-g00ecf