blob: fa66109061979d659fd05285f9a9c6c07c3ac111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "bitvec.h"
void
bitvec::dump (FILE *file) const
{
size_t bits = m_bits.length () * bits_per_elt;
fprintf (file, "n_bits = %d, set = {", (int) bits);
for (size_t pos = 30, i = 0; i < bits; i++)
if ((*this)[i])
{
if (pos > 70)
{
fprintf (file, "\n ");
pos = 0;
}
fprintf (file, "%d ", (int) i);
pos += 2 + (i >= 10) + (i >= 100) + (i >= 1000);
}
fprintf (file, "}\n");
}
ssize_t
bitvec::first_set_bit () const
{
for (size_t i = begin (); i < end (); i++)
if ((*this)[i])
return i;
return -1;
}
|