57 #define int64_t __int64
62 #include <sys/types.h>
102 int type()
const {
return fType; }
110 operator int()
const {
return (fType ==
kIntNode) ? fData.i : (fType ==
kDoubleNode) ?
int(fData.f) : 0 ; }
111 operator double()
const {
return (fType ==
kIntNode) ? double(fData.i) : (fType ==
kDoubleNode) ? fData.f : 0.0 ; }
113 ostream&
print (ostream& fout)
const;
252 : (double(
int(x)/
int(y))==double(x)/double(y)) ?
Node(
int(x)/int(y))
253 :
Node(
double(x)/double(y)); }
256 {
return Node(
int(x)%
int(y)); }
270 {
return Node(
int(x)<<
int(y)); }
273 {
return Node(
int(x)>>
int(y)); }
279 {
return Node(
int(x)&
int(y)); }
282 {
return Node(
int(x)|
int(y)); }
285 {
return Node(
int(x)^
int(y)); }
const Node leNode(const Node &x, const Node &y)
const Node eqNode(const Node &x, const Node &y)
A library to create and manipulate symbols with a unique name.
Class Node = (type x (int + double + Sym + void*))
const Node addNode(const Node &x, const Node &y)
ostream & print(ostream &fout) const
print a node on a stream
bool isZero(const Node &n)
const Node divExtendedNode(const Node &x, const Node &y)
const Node remNode(const Node &x, const Node &y)
const Node xorNode(const Node &x, const Node &y)
ostream & operator<<(ostream &s, const Node &n)
const Node gtNode(const Node &x, const Node &y)
bool isGEZero(const Node &n)
const Node ltNode(const Node &x, const Node &y)
const Node rshNode(const Node &x, const Node &y)
const Node mulNode(const Node &x, const Node &y)
interval operator!=(const interval &, const interval &)
const Node geNode(const Node &x, const Node &y)
bool isMinusOne(const Node &n)
const Node minusNode(const Node &x)
bool isNum(const Node &n)
bool isDouble(const Node &n)
bool isSym(const Node &n)
const char * name(Symbol *sym)
Returns the name of a symbol.
const Node neNode(const Node &x, const Node &y)
Symbols are unique objects with a name stored in a hash table.
const Node subNode(const Node &x, const Node &y)
bool isGTZero(const Node &n)
bool isOne(const Node &n)
const Node lshNode(const Node &x, const Node &y)
interval operator==(const interval &, const interval &)
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
bool isPointer(const Node &n)
bool isInt(const Node &n)
const Node andNode(const Node &x, const Node &y)
void * getPointer() const
const Node inverseNode(const Node &x)
void print(Tree t, FILE *out)
const Node orNode(const Node &x, const Node &y)