mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 03:15:50 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
45
lib/approx_nat.h
Normal file
45
lib/approx_nat.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*++
|
||||
Copyright (c) 2007 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
approx_nat.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Approximated natural numbers. It performs operations on the set [0, ..., 2^{n-2}, huge].
|
||||
Where huge represents all numbers greater than 2^{n-2}.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2008-01-11
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _APPROX_NAT_H_
|
||||
#define _APPROX_NAT_H_
|
||||
|
||||
#include<iostream>
|
||||
#include<limits.h>
|
||||
|
||||
class approx_nat {
|
||||
unsigned m_value;
|
||||
static const unsigned m_limit = UINT_MAX >> 2;
|
||||
public:
|
||||
approx_nat():m_value(0) {}
|
||||
explicit approx_nat(unsigned val);
|
||||
bool is_huge() const { return m_value == UINT_MAX; }
|
||||
unsigned get_value() const { return m_value; }
|
||||
approx_nat & operator=(unsigned w);
|
||||
approx_nat & operator+=(unsigned w);
|
||||
approx_nat & operator+=(approx_nat const & w) { return operator+=(w.m_value); }
|
||||
approx_nat & operator*=(unsigned w);
|
||||
approx_nat & operator*=(approx_nat const & w) { return operator*=(w.m_value); }
|
||||
bool operator<(unsigned w) const { return !is_huge() && m_value < w; }
|
||||
bool operator<(approx_nat const & w) const { return !is_huge() && !w.is_huge() && m_value < w.m_value; }
|
||||
};
|
||||
|
||||
std::ostream & operator<<(std::ostream & target, approx_nat const & w);
|
||||
|
||||
#endif /* _APPROX_NAT_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue