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

Method val

gecode/int/branch/view-values.hpp:68–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 };
67
68 forceinline int
69 PosValuesChoice::val(unsigned int a) const {
70 PosMin* l = &pm[0];
71 PosMin* r = &pm[n-1];
72 while (true) {
73 PosMin* m = l + (r-l)/2;
74 if (a < m->pos) {
75 r=m-1;
76 } else if (a >= (m+1)->pos) {
77 l=m+1;
78 } else {
79 return m->min + static_cast<int>(a - m->pos);
80 }
81 }
82 GECODE_NEVER;
83 return 0;
84 }
85
86
87 template<int n, bool min, class Filter, class Print>

Callers 3

commitMethod · 0.45
nglMethod · 0.45
printMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected