+static int ptrcompares(const void *p1, const void *p2) {
+ uintptr_t b1 = *(uintptr_t const *) p1;
+ uintptr_t b2 = *(uintptr_t const *) p2;
+ if (b1 < b2)
+ return -1;
+ else if (b1 == b2)
+ return 0;
+ else
+ return 1;
+}
+
+BooleanEdge CSolver::rewriteLogicalOperation(LogicOp op, BooleanEdge * array, uint asize) {
+ BooleanEdge newarray[asize];
+ memcpy(newarray, array, asize * sizeof(BooleanEdge));
+ for(uint i=0; i < asize; i++) {
+ BooleanEdge b=newarray[i];
+ if (b->type == LOGICOP) {
+ if (((BooleanLogic *) b.getBoolean())->replaced) {
+ newarray[i] = doRewrite(newarray[i]);
+ i--;//Check again
+ }
+ }
+ }
+ return applyLogicalOperation(op, newarray, asize);
+}