MCPcopy Create free account
hub / github.com/apache/trafficserver / lower_node

Method lower_node

lib/swoc/include/swoc/DiscreteRange.h:1112–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110
1111template <typename METRIC, typename PAYLOAD>
1112auto
1113DiscreteSpace<METRIC, PAYLOAD>::lower_node(METRIC const &target) -> Node * {
1114 Node *n = _root; // current node to test.
1115 Node *zret = nullptr; // best node so far.
1116
1117 // Fast check for sequential insertion
1118 if (auto ln = _list.tail(); ln != nullptr && ln->max() < target) {
1119 return ln;
1120 }
1121
1122 while (n) {
1123 if (target < n->min()) {
1124 n = left(n);
1125 } else {
1126 zret = n; // this is a better candidate.
1127 if (n->max() < target) {
1128 n = right(n);
1129 } else {
1130 break;
1131 }
1132 }
1133 }
1134 return zret;
1135}
1136
1137template <typename METRIC, typename PAYLOAD>
1138auto

Callers 4

lower_boundMethod · 0.95
intersectionMethod · 0.95
blendMethod · 0.95
DiscreteRange.hFile · 0.80

Calls 3

tailMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected