Commit 587c7a4a authored by william's avatar william

re-add one of our old bit fill operations, as it turns out it was actually...

re-add one of our old bit fill operations, as it turns out it was actually needed (probably shouldn't have worked on that code in a sleep-deprived state)
parent 6eee489d
......@@ -400,9 +400,19 @@ TIMEOUT_PUBLIC void timeouts_update(struct timeouts *T, abstime_t curtime) {
pending = (wheel_t)~WHEEL_C(0);
} else {
wheel_t _elapsed = WHEEL_MASK & (elapsed >> (wheel * WHEEL_BIT));
int slot = WHEEL_MASK & (curtime >> (wheel * WHEEL_BIT));
pending = rotr(rotl(((WHEEL_C(1) << _elapsed) - 1), slot), _elapsed);
pending |= WHEEL_C(1) << slot;
int oslot, nslot;
/*
* TODO: It's likely that at least one of the
* following three bit fill operations is redundant
* or can be replaced with a simpler operation.
*/
oslot = WHEEL_MASK & (T->curtime >> (wheel * WHEEL_BIT));
pending = rotl(((UINT64_C(1) << _elapsed) - 1), oslot);
nslot = WHEEL_MASK & (curtime >> (wheel * WHEEL_BIT));
pending |= rotr(rotl(((WHEEL_C(1) << _elapsed) - 1), nslot), _elapsed);
pending |= WHEEL_C(1) << nslot;
}
while (pending & T->pending[wheel]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment