From e6ab97802463c9d4a5f0261bace424a0edb8b73a Mon Sep 17 00:00:00 2001 From: Peter Clifton Date: Mon, 13 Oct 2008 19:22:02 +0000 Subject: [PATCH] Change rtree penalty function in rtree.c to use doubles, not long long. Since the exact integer result doesn't matter, this is ok. Marginally faster on Core Duo machine. --- src/rtree.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/rtree.c b/src/rtree.c index 1f205855..af6c8cce 100644 --- a/src/rtree.c +++ b/src/rtree.c @@ -79,7 +79,6 @@ RCSID ("$Id$"); #define SORT_NONLEAF #define DELETE_BY_POINTER -typedef long long bigun; typedef struct { @@ -878,21 +877,20 @@ contained (struct rtree_node *node, const BoxType * query) } -static inline bigun +static inline double penalty (struct rtree_node *node, const BoxType * query) { - long long score; + double score; /* Compute the area penalty for inserting here and return. * The penalty is the increase in area necessary * to include the query-> */ - score = (MAX (node->box.X2, query->X2) - MIN (node->box.X1, query->X1)); - score *= - (MAX (node->box.Y2, query->Y2) - MIN (node->box.Y1, query->Y1)); + score = (MAX (node->box.X2, query->X2) - MIN (node->box.X1, query->X1)); + score *= (MAX (node->box.Y2, query->Y2) - MIN (node->box.Y1, query->Y1)); score -= - ((long long) node->box.X2 - - node->box.X1) * ((long long) node->box.Y2 - node->box.Y1); + (double)(node->box.X2 - node->box.X1) * + (double)(node->box.Y2 - node->box.Y1); return score; } @@ -957,7 +955,7 @@ __r_insert_node (struct rtree_node *node, const BoxType * query, { int i; struct rtree_node *best_node; - long long score, best_score; + double score, best_score; if (force) { -- 2.11.4.GIT