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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
approx_set.cpp
Abstract:
Approximated sets.
Author:
Leonardo de Moura (leonardo) 2007-03-02.
Revision History:
--*/
#include "util/approx_set.h"
void approx_set::display(std::ostream & out) const {
out << "{";
bool first = true;
unsigned long long s = m_set;
for (unsigned i = 0; i < approx_set_traits<unsigned long long>::capacity; i++) {
if ((s & 1) != 0) {
if (first) {
first = false;
}
else {
out << ", ";
}
out << i;
}
s = s >> 1;
}
out << "}";
}
unsigned approx_set::size() const {
unsigned long long tmp = m_set;
unsigned r = 0;
while (tmp > 0) {
if ((tmp & 1) != 0) {
r++;
}
tmp = tmp >> 1;
}
return r;
}