summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/bitary.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-04-09 03:20:40 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-04-09 11:02:10 +0200
commit8bf01c43c17c1111a580daa0e3906cae1cccef6a (patch)
tree4dac3070de755a493361e782829304da26d26531 /crawl-ref/source/bitary.h
parent441f6435328c8c2e68de689e1a4c7dc687a0760c (diff)
downloadcrawl-ref-8bf01c43c17c1111a580daa0e3906cae1cccef6a.tar.gz
crawl-ref-8bf01c43c17c1111a580daa0e3906cae1cccef6a.zip
Use FixedBitArray instead of large arrays of bools.
The only cost is having assignments be a function, as you can't overload operator[] to have separate bits be lvalues.
Diffstat (limited to 'crawl-ref/source/bitary.h')
-rw-r--r--crawl-ref/source/bitary.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h
index 065afbba1c..5920e798f1 100644
--- a/crawl-ref/source/bitary.h
+++ b/crawl-ref/source/bitary.h
@@ -94,6 +94,13 @@ public:
data[i] &= x.data[i];
return *this;
}
+
+ void init(bool value)
+ {
+ long fill = value ? ~(long)0 : 0;
+ for (unsigned int i = 0; i < ARRAYSZ(data); i++)
+ data[i] = fill;
+ }
};
template <unsigned int SIZEX, unsigned int SIZEY> class FixedBitArray