mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
Reorganizing source code. Created util dir
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
630ba0c675
commit
2c464d413d
153 changed files with 0 additions and 0 deletions
52
src/util/approx_set.cpp
Normal file
52
src/util/approx_set.cpp
Normal file
|
@ -0,0 +1,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"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;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue