| 237 | */ |
| 238 | template<class Val> |
| 239 | forceinline bool |
| 240 | PosSupportIter<Val>::reset(Val& d) { |
| 241 | // Way too small, no value can make it big enough |
| 242 | if (d + static_cast<Val>(a)*x.max() < u) |
| 243 | return false; |
| 244 | // Restart iterator and position of values |
| 245 | i.init(x.varimp()); p = 0; |
| 246 | // Skip all ranges which are too small |
| 247 | while (d + static_cast<Val>(a)*i.max() < u) { |
| 248 | p += i.width(); ++i; |
| 249 | } |
| 250 | // There is at least one range left (check of max) |
| 251 | assert(i()); |
| 252 | // Initialize current range and adjust value |
| 253 | c = i.min(); |
| 254 | // Skip all values which are too small |
| 255 | while (d + static_cast<Val>(a)*c < u) { |
| 256 | p++; c++; |
| 257 | } |
| 258 | // Adjust to new value |
| 259 | d += static_cast<Val>(a) * c; |
| 260 | return true; |
| 261 | } |
| 262 | template<class Val> |
| 263 | forceinline bool |
| 264 | PosSupportIter<Val>::adjust(Val& d) { |