inline ExecStatus Eqv<BVA,BVB,BVC>::post(Home home, BVA b0, BVB b1, BVC b2){ switch (bool_test(b0,b1)) { case BT_SAME: GECODE_ME_CHECK(b2.one(home)); break; case BT_COMP: GECODE_ME_CHECK(b2.zero(home)); break; case BT_NONE: if (b2.one()) return Eq<BVA,BVB>::post(home,b0,b1); if (b0.one()) { if (b1.one()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } } if (b0.zero()) { if (b1.one()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } } (void) new (home) Eqv(home,b0,b1,b2); break; default: GECODE_NEVER; } return ES_OK; }
inline ExecStatus QXor<BVA,BVB>::post(Home home, BVA b0, TQuantifier _q0, int _r0, BVB b1, TQuantifier _q1, int _r1) { switch (bool_test(b0,b1)) { case BT_SAME: return ES_FAILED; case BT_COMP: return ES_OK; case BT_NONE: if ( ((_q0 == FORALL) && (_q1 == FORALL)) || ((_r0 < _r1) && (_q1 == FORALL)) || ((_r0 > _r1) && (_q0 == FORALL)) ) return ES_FAILED; if (b0.zero()) { if (_q1 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b1.one(home)); } else if (b0.one()) { if (_q1 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b1.zero(home)); } else if (b1.zero()) { if (_q0 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b0.one(home)); } else if (b1.one()) { if (_q0 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b0.zero(home)); } else { (void) new (home) QXor<BVA,BVB>(home,b0,_q0,_r0,b1,_q1,_r1); } break; default: GECODE_NEVER; } return ES_OK; }
inline ExecStatus QEqv<BVA,BVB,BVC>::post(Home home, BVA b0, TQuantifier _q0, int _r0, BVB b1, TQuantifier _q1, int _r1, BVC b2) { switch (bool_test(b0,b1)) { case BT_SAME: GECODE_ME_CHECK(b2.one(home)); break; case BT_COMP: GECODE_ME_CHECK(b2.zero(home)); break; case BT_NONE: if ( ((_q0 == FORALL) && (_q1 == FORALL)) || ((_r0 < _r1) && (_q1 == FORALL)) || ((_r0 > _r1) && (_q0 == FORALL)) ) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } if (b2.one()) return QEq<BVA,BVB>::post(home,b0,_q0,_r0,b1,_q1,_r1); if (b2.zero()) return QXor<BVA,BVB>::post(home,b0,_q0,_r0,b1,_q1,_r1); if (b0.one()) { if (b1.one()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } } if (b0.zero()) { if (b1.one()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } } (void) new (home) QEqv(home,b0,_q0,_r0,b1,_q1,_r1,b2); break; default: GECODE_NEVER; } return ES_OK; }