SQLite

Check-in [07fe622820]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the cellMargin() routine of R-Tree slightly smaller and faster while also fixing a harmless compiler warning.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07fe6228208684d579c4f6c334c90eb6262a9233
User & Date: drh 2017-02-07 12:58:38.284
Context
2017-02-07
13:51
Fix SQLITE_BYTEORDER #defines in R-Tree when compiled separately from the amalgamation. (check-in: a136609c98 user: drh tags: trunk)
12:58
Make the cellMargin() routine of R-Tree slightly smaller and faster while also fixing a harmless compiler warning. (check-in: 07fe622820 user: drh tags: trunk)
03:44
Back out [ec8ff892ac] which is causing missed OOM errors on some tests. (check-in: 0611770d6a user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rtree/rtree.c.
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962

1963
1964
1965
1966
1967
1968
1969
1970
}

/*
** Return the margin length of cell p. The margin length is the sum
** of the objects size in each dimension.
*/
static RtreeDValue cellMargin(Rtree *pRtree, RtreeCell *p){
  RtreeDValue margin;
  int ii;
  margin = DCOORD(p->aCoord[1]) - DCOORD(p->aCoord[0]);
  for(ii=2; ii<pRtree->nDim2; ii+=2){
    margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));

  }
  return margin;
}

/*
** Store the union of cells p1 and p2 in p1.
*/
static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){







|
|
|
<

>
|







1951
1952
1953
1954
1955
1956
1957
1958
1959
1960

1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
}

/*
** Return the margin length of cell p. The margin length is the sum
** of the objects size in each dimension.
*/
static RtreeDValue cellMargin(Rtree *pRtree, RtreeCell *p){
  RtreeDValue margin = 0;
  int ii = pRtree->nDim2 - 2;
  do{

    margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
    ii -= 2;
  }while( ii>=0 );
  return margin;
}

/*
** Store the union of cells p1 and p2 in p1.
*/
static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){