6 FunctionOperator::FunctionOperator(ArithOp _op, Set **domain, uint numDomain, Set *_range, OverFlowBehavior _overflowbehavior) :
7 Function(OPERATORFUNC),
9 domains(domain, numDomain),
11 overflowbehavior(_overflowbehavior) {
14 FunctionTable::FunctionTable (Table *_table, UndefinedBehavior _undefBehavior) :
17 undefBehavior(_undefBehavior) {
20 uint64_t FunctionOperator::applyFunctionOperator(uint numVals, uint64_t *values) {
24 return values[0] + values[1];
27 return values[0] - values[1];
34 bool FunctionOperator::isInRangeFunction(uint64_t val) {
35 return range->exists(val);
38 Function *FunctionOperator::clone(CSolver *solver, CloneMap *map) {
39 Function *f = (Function *) map->get(this);
43 Set *array[domains.getSize()];
44 for (uint i = 0; i < domains.getSize(); i++) {
45 array[i] = domains.get(i)->clone(solver, map);
47 Set *rcopy = range->clone(solver, map);
48 f = solver->createFunctionOperator(op, array, domains.getSize(), rcopy, overflowbehavior);
53 Function *FunctionTable::clone(CSolver *solver, CloneMap *map) {
54 Function *f = (Function *) map->get(this);
58 Table *tcopy = table->clone(solver, map);
59 f = solver->completeTable(tcopy, undefBehavior);