summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-05-08 21:21:41 +0000
committerroot <root>2008-05-08 21:21:41 +0000
commitb83baebfc671e65cb1a105e3bbc3ba6795149db7 (patch)
tree34dc444d671de737c265366aca8f9411e52b1e84
parent0077650b487020b0a60ec203eb7cca603b60710c (diff)
*** empty log message ***
-rw-r--r--ev.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ev.c b/ev.c
index 753fd57..62c7ee1 100644
--- a/ev.c
+++ b/ev.c
@@ -778,12 +778,13 @@ void inline_speed
upheap (WT *heap, int k)
{
WT w = heap [k];
+ ev_tstamp w_at = w->at;
for (;;)
{
int p = ((k - HEAP0 - 1) / DHEAP) + HEAP0;
- if (p == k || heap [p]->at <= w->at)
+ if (p == k || heap [p]->at <= w_at)
break;
heap [k] = heap [p];
@@ -811,22 +812,20 @@ downheap (WT *heap, int N, int k)
// find minimum child
if (expect_true (pos + DHEAP - 1 < E))
{
- /* fast path */
- (minpos = pos + 0), (minat = (*minpos)->at);
+ /* fast path */ (minpos = pos + 0), (minat = (*minpos)->at);
if (pos [1]->at < minat) (minpos = pos + 1), (minat = (*minpos)->at);
if (pos [2]->at < minat) (minpos = pos + 2), (minat = (*minpos)->at);
if (pos [3]->at < minat) (minpos = pos + 3), (minat = (*minpos)->at);
}
- else
+ else if (pos < E)
{
- /* slow path */
- if (pos >= E)
- break;
- (minpos = pos + 0), (minat = (*minpos)->at);
+ /* slow path */ (minpos = pos + 0), (minat = (*minpos)->at);
if (pos + 1 < E && pos [1]->at < minat) (minpos = pos + 1), (minat = (*minpos)->at);
if (pos + 2 < E && pos [2]->at < minat) (minpos = pos + 2), (minat = (*minpos)->at);
if (pos + 3 < E && pos [3]->at < minat) (minpos = pos + 3), (minat = (*minpos)->at);
}
+ else
+ break;
if (w->at <= minat)
break;