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 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; }