MCPcopy Create free account
hub / github.com/Gecode/gecode / lookupValue

Function lookupValue

gecode/int/gcc/view.hpp:44–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 /// Return index of \a v in array \a a
43 template<class T>
44 forceinline bool
45 lookupValue(T& a, int v, int& i) {
46 int l = 0;
47 int r = a.size() - 1;
48
49 while (l <= r) {
50 int m = l + (r - l) / 2;
51 if (v == a[m].card()) {
52 i=m; return true;
53 } else if (l == r) {
54 return false;
55 } else if (v < a[m].card()) {
56 r=m-1;
57 } else {
58 l=m+1;
59 }
60 }
61 return false;
62 }
63
64 /// Constant view containing lower and upper cardinality bounds
65 class CardConst {

Callers 4

prop_cardFunction · 0.85
prop_valFunction · 0.85
propagateMethod · 0.85
propagateMethod · 0.85

Calls 2

sizeMethod · 0.45
cardMethod · 0.45

Tested by

no test coverage detected