diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-06-18 14:37:51 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-06-19 14:38:30 +0200 |
commit | b47796fe2177b30c3406e2735c2e7b9b4a892292 (patch) | |
tree | 442160799313b0c24a340daa809c1fe718da0039 /crawl-ref/source/bitary.h | |
parent | 4835408b6ab43dc3c71c0b594bb414fab33921cf (diff) | |
download | crawl-ref-b47796fe2177b30c3406e2735c2e7b9b4a892292.tar.gz crawl-ref-b47796fe2177b30c3406e2735c2e7b9b4a892292.zip |
Use ARRAYSZ() instead of sizeof division, for readability.
Also, it's not vulnerable to changes to the underlying types.
Diffstat (limited to 'crawl-ref/source/bitary.h')
-rw-r--r-- | crawl-ref/source/bitary.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h index 291ca4bb88..b01f9ddff5 100644 --- a/crawl-ref/source/bitary.h +++ b/crawl-ref/source/bitary.h @@ -41,7 +41,7 @@ protected: public: void reset() { - for (unsigned int i = 0; i < sizeof(data) / sizeof(unsigned long); i++) + for (unsigned int i = 0; i < ARRAYSZ(data); i++) data[i] = 0; } @@ -79,14 +79,14 @@ public: inline FixedBitArray<SIZE>& operator|=(const FixedBitArray<SIZE>&x) { - for (unsigned int i = 0; i < sizeof(data) / sizeof(unsigned long); i++) + for (unsigned int i = 0; i < ARRAYSZ(data); i++) data[i] |= x.data[i]; return *this; } inline FixedBitArray<SIZE>& operator&=(const FixedBitArray<SIZE>&x) { - for (unsigned int i = 0; i < sizeof(data) / sizeof(unsigned long); i++) + for (unsigned int i = 0; i < ARRAYSZ(data); i++) data[i] &= x.data[i]; return *this; } |