| 402 | |
| 403 | template<class V0, class V1> |
| 404 | forceinline ExecStatus |
| 405 | post_int(Home home, IntSharedArray& c, V0 x0, V1 x1) { |
| 406 | assert(c.size() > 0); |
| 407 | GECODE_ME_CHECK(x0.gq(home,0)); |
| 408 | GECODE_ME_CHECK(x0.le(home,c.size())); |
| 409 | Support::IntType idx_type = Support::s_type(c.size()); |
| 410 | int min = c[0]; |
| 411 | int max = c[0]; |
| 412 | for (int i=1; i<c.size(); i++) { |
| 413 | min = std::min(c[i],min); max = std::max(c[i],max); |
| 414 | } |
| 415 | GECODE_ME_CHECK(x1.gq(home,min)); |
| 416 | GECODE_ME_CHECK(x1.lq(home,max)); |
| 417 | Support::IntType val_type = |
| 418 | std::max(Support::s_type(min),Support::s_type(max)); |
| 419 | switch (idx_type) { |
| 420 | case Support::IT_CHAR: |
| 421 | switch (val_type) { |
| 422 | case Support::IT_CHAR: |
| 423 | return Int<V0,V1,signed char,signed char>::post(home,c,x0,x1); |
| 424 | case Support::IT_SHRT: |
| 425 | return Int<V0,V1,signed char,signed short int>::post(home,c,x0,x1); |
| 426 | default: break; |
| 427 | } |
| 428 | break; |
| 429 | case Support::IT_SHRT: |
| 430 | switch (val_type) { |
| 431 | case Support::IT_CHAR: |
| 432 | case Support::IT_SHRT: |
| 433 | return Int<V0,V1,signed short int,signed short int>::post(home,c,x0,x1); |
| 434 | default: break; |
| 435 | } |
| 436 | break; |
| 437 | default: break; |
| 438 | } |
| 439 | return Int<V0,V1,signed int,signed int>::post(home,c,x0,x1); |
| 440 | } |
| 441 | |
| 442 | }}} |
| 443 | |