auto length = last - first;
while (length > 0) {
auto half = length / 2;
if (comp(first[half], value)) {
// length - half equals half + length % 2
first += length - half;
}
length = half;
}
return first;
can be restructured with a conditional `first += half` and instead `length -= half` (see, e.g., Listing 2 in https://arxiv.org/abs/1509.05053). Doing it this way requires one final comparison when `length > 0` on entry, because the while condition is `length > 1`, but moves the subtraction off the critical path. replies(1):