| 97 | */ |
| 98 | template <class View> |
| 99 | ValueSymmetryImp<View>* |
| 100 | specialUpdate(Space& home, ValueSymmetryImp<View>* s, IntSet usedValues) { |
| 101 | // Calculate intersection and difference. |
| 102 | IntArgs intersection; |
| 103 | IntArgs difference; |
| 104 | int n = 0; |
| 105 | for (int i = s->values.next(s->values.offset()) ; |
| 106 | i <= s->values.max_bit() ; i = s->values.next(i+1)) { |
| 107 | n++; |
| 108 | if (usedValues.in(i)) |
| 109 | intersection << i; |
| 110 | else |
| 111 | difference << i; |
| 112 | } |
| 113 | |
| 114 | for (IntSetValues v(usedValues) ; v() ; ++v) { |
| 115 | s->update(Literal(0, v.val())); |
| 116 | } |
| 117 | |
| 118 | if (intersection.size() < 2) |
| 119 | return nullptr; |
| 120 | int *a = new int[intersection.size()]; |
| 121 | for (int i = 0 ; i < intersection.size() ; i++) { |
| 122 | a[i] = intersection[i]; |
| 123 | } |
| 124 | ValueSymmetryImp<View>* ns = |
| 125 | new (home) ValueSymmetryImp<View>(home, a, intersection.size()); |
| 126 | delete [] a; |
| 127 | return ns; |
| 128 | } |
| 129 | |
| 130 | template<class View, int n, class Val, unsigned int a, |
| 131 | class Filter, class Print> |