Mercurial > dedupe
comparison BitArray.hpp @ 54:f339499ecd79
Remove multiplexing.
Comment on defines which should be removed from header.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 13 Sep 2012 23:40:46 +0200 |
| parents | 725b0d776f3c |
| children | 9161e9fd5b3f |
comparison
equal
deleted
inserted
replaced
| 53:bd7ca4ceefec | 54:f339499ecd79 |
|---|---|
| 1 #ifndef BITARRAY_HPP | 1 #ifndef BITARRAY_HPP |
| 2 #define BITARRAY_HPP | 2 #define BITARRAY_HPP |
| 3 | 3 |
| 4 | |
| 5 #if 0 | |
| 6 #include <QtCore/QBitArray> | |
| 7 typedef QBitArray BitArray; | |
| 8 #else | |
| 9 #include <ostream> | 4 #include <ostream> |
| 10 | 5 |
| 6 //We should remove these defines from the header, but we keep them for | |
| 7 //now until we have stabilized the API and removed any bugs. | |
| 11 #define HIGH(B) ((B) >> 3) | 8 #define HIGH(B) ((B) >> 3) |
| 12 #define LOW(B) ((B) & 0x07) | 9 #define LOW(B) ((B) & 0x07) |
| 13 | |
| 14 #define MASK(X) (0x1 << (7 - X)) | 10 #define MASK(X) (0x1 << (7 - X)) |
| 15 #define SELECTMASK(X) (uchar(MASK(X))) | 11 #define SELECTMASK(X) (uchar(MASK(X))) |
| 16 #define DESELECTMASK(X) (uchar(~MASK(X))) | 12 #define DESELECTMASK(X) (uchar(~MASK(X))) |
| 17 | |
| 18 #define NUMCHARS(X) HIGH(X + 7) | 13 #define NUMCHARS(X) HIGH(X + 7) |
| 19 | 14 |
| 20 #include <cassert> | 15 #include <cassert> |
| 21 | 16 |
| 22 class QBitArray; | 17 class QBitArray; |
| 36 } | 31 } |
| 37 } | 32 } |
| 38 | 33 |
| 39 BitArray(uint size) : size_(size), bits(new uchar[NUMCHARS(size)]) | 34 BitArray(uint size) : size_(size), bits(new uchar[NUMCHARS(size)]) |
| 40 { | 35 { |
| 36 //We need to initialize the bits beyond size, since they are | |
| 37 //implicitly used in certain functions. | |
| 41 bits[NUMCHARS(size) - 1] = 0; | 38 bits[NUMCHARS(size) - 1] = 0; |
| 42 } | 39 } |
| 43 | 40 |
| 44 BitArray() : size_(0), bits(0) | 41 BitArray() : size_(0), bits(0) |
| 45 { | 42 { |
| 87 BitArray& operator=(const BitArray& rhs); | 84 BitArray& operator=(const BitArray& rhs); |
| 88 }; | 85 }; |
| 89 | 86 |
| 90 std::ostream& operator<<(std::ostream& out, const BitArray& rhs); | 87 std::ostream& operator<<(std::ostream& out, const BitArray& rhs); |
| 91 | 88 |
| 92 #endif | |
| 93 | |
| 94 #endif //BITARRAY_HPP | 89 #endif //BITARRAY_HPP |
