| 141 | } |
| 142 | |
| 143 | ExecStatus |
| 144 | MultBnd::post(Home home, IntView x0, IntView x1, IntView x2) { |
| 145 | if (x0 == x1) { |
| 146 | SqrOps ops; |
| 147 | return PowBnd<SqrOps>::post(home,x0,x2,ops); |
| 148 | } |
| 149 | if (x0 == x2) |
| 150 | return MultZeroOne<IntView,PC_INT_BND>::post(home,x0,x1); |
| 151 | if (x1 == x2) |
| 152 | return MultZeroOne<IntView,PC_INT_BND>::post(home,x1,x0); |
| 153 | if (pos(x0)) { |
| 154 | if (pos(x1) || pos(x2)) goto post_ppp; |
| 155 | if (neg(x1) || neg(x2)) goto post_pnn; |
| 156 | } else if (neg(x0)) { |
| 157 | if (neg(x1) || pos(x2)) goto post_nnp; |
| 158 | if (pos(x1) || neg(x2)) goto post_npn; |
| 159 | } else if (pos(x1)) { |
| 160 | if (pos(x2)) goto post_ppp; |
| 161 | if (neg(x2)) goto post_npn; |
| 162 | } else if (neg(x1)) { |
| 163 | if (pos(x2)) goto post_nnp; |
| 164 | if (neg(x2)) goto post_pnn; |
| 165 | } |
| 166 | { |
| 167 | long long int a = mll(x0.min(),x1.min()); |
| 168 | long long int b = mll(x0.min(),x1.max()); |
| 169 | long long int c = mll(x0.max(),x1.min()); |
| 170 | long long int d = mll(x0.max(),x1.max()); |
| 171 | GECODE_ME_CHECK(x2.gq(home,std::min(std::min(a,b),std::min(c,d)))); |
| 172 | GECODE_ME_CHECK(x2.lq(home,std::max(std::max(a,b),std::max(c,d)))); |
| 173 | (void) new (home) MultBnd(home,x0,x1,x2); |
| 174 | } |
| 175 | return ES_OK; |
| 176 | |
| 177 | post_ppp: |
| 178 | return MultPlusBnd<IntView,IntView,IntView> |
| 179 | ::post(home,x0,x1,x2); |
| 180 | post_nnp: |
| 181 | return MultPlusBnd<MinusView,MinusView,IntView> |
| 182 | ::post(home,MinusView(x0),MinusView(x1),x2); |
| 183 | post_pnn: |
| 184 | std::swap(x0,x1); |
| 185 | post_npn: |
| 186 | return MultPlusBnd<MinusView,IntView,MinusView> |
| 187 | ::post(home,MinusView(x0),x1,MinusView(x2)); |
| 188 | } |
| 189 | |
| 190 | |
| 191 | |