| 28 | } |
| 29 | |
| 30 | void BitMap::set(const int index, const bool status) |
| 31 | { |
| 32 | int pos = index / 8; |
| 33 | int offset = index % 8; |
| 34 | |
| 35 | // 清0 |
| 36 | bitmap[pos] = bitmap[pos] & (~(1 << offset)); |
| 37 | |
| 38 | // 置1 |
| 39 | if (status) |
| 40 | { |
| 41 | bitmap[pos] = bitmap[pos] | (1 << offset); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | int BitMap::allocate(const int count) |
| 46 | { |
nothing calls this directly
no outgoing calls
no test coverage detected