mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Performance optimization to cellContains() in RTREE.
FossilOrigin-Name: 43cde22bf3f36687df231eddf642581d1d4f4102ad8568d31f5b2ff0302ca800
This commit is contained in:
@ -2162,14 +2162,17 @@ static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){
|
||||
*/
|
||||
static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){
|
||||
int ii;
|
||||
int isInt = (pRtree->eCoordType==RTREE_COORD_INT32);
|
||||
for(ii=0; ii<pRtree->nDim2; ii+=2){
|
||||
RtreeCoord *a1 = &p1->aCoord[ii];
|
||||
RtreeCoord *a2 = &p2->aCoord[ii];
|
||||
if( (!isInt && (a2[0].f<a1[0].f || a2[1].f>a1[1].f))
|
||||
|| ( isInt && (a2[0].i<a1[0].i || a2[1].i>a1[1].i))
|
||||
){
|
||||
return 0;
|
||||
if( pRtree->eCoordType==RTREE_COORD_INT32 ){
|
||||
for(ii=0; ii<pRtree->nDim2; ii+=2){
|
||||
RtreeCoord *a1 = &p1->aCoord[ii];
|
||||
RtreeCoord *a2 = &p2->aCoord[ii];
|
||||
if( a2[0].i<a1[0].i || a2[1].i>a1[1].i ) return 0;
|
||||
}
|
||||
}else{
|
||||
for(ii=0; ii<pRtree->nDim2; ii+=2){
|
||||
RtreeCoord *a1 = &p1->aCoord[ii];
|
||||
RtreeCoord *a2 = &p2->aCoord[ii];
|
||||
if( a2[0].f<a1[0].f || a2[1].f>a1[1].f ) return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user