bitvect: fix block_count() on 0-sized bit-vectors

The bug was introduced by 522373984c.

* src/misc/bitvect.hh (block_count): Here.
* src/tgbatest/dstar.test: Add a test case.
This commit is contained in:
Alexandre Duret-Lutz 2014-01-23 23:09:28 +01:00
parent 91789b9b12
commit 4f31a9bbed
2 changed files with 32 additions and 2 deletions

View file

@ -131,7 +131,7 @@ namespace spot
size_t used_blocks() const
{
const size_t bpb = 8 * sizeof(block_t);
return (size_ - 1) / bpb + 1;
return (size_ + bpb - 1) / bpb;
}
/// Append one bit.