mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Unwind the RTREE dimension loop inside of rtreeCallbackConstraint().
FossilOrigin-Name: 4854ea9c18e7d8066c90b41568d0fae97b01ea6d
This commit is contained in:
@ -1078,6 +1078,7 @@ static int rtreeCallbackConstraint(
|
||||
sqlite3_rtree_query_info *pInfo = pConstraint->pInfo; /* Callback info */
|
||||
int nCoord = pInfo->nCoord; /* No. of coordinates */
|
||||
int rc; /* Callback return code */
|
||||
RtreeCoord c; /* Translator union */
|
||||
sqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2]; /* Decoded coordinates */
|
||||
|
||||
assert( pConstraint->op==RTREE_MATCH || pConstraint->op==RTREE_QUERY );
|
||||
@ -1086,15 +1087,37 @@ static int rtreeCallbackConstraint(
|
||||
if( pConstraint->op==RTREE_QUERY && pSearch->iLevel==1 ){
|
||||
pInfo->iRowid = readInt64(pCellData);
|
||||
}
|
||||
assert( nCoord>=2 && (nCoord&1)==0 );
|
||||
i = 0;
|
||||
do{
|
||||
pCellData += 8;
|
||||
assert( ((((char*)pCellData) - (char*)0)&3)==0 ); /* 4-byte aligned */
|
||||
RTREE_DECODE_COORD(eInt, pCellData, aCoord[i]);
|
||||
RTREE_DECODE_COORD(eInt, (pCellData+4), aCoord[i+1]);
|
||||
i+= 2;
|
||||
}while( i<nCoord );
|
||||
pCellData += 8;
|
||||
#ifndef SQLITE_RTREE_INT_ONLY
|
||||
if( eInt==0 ){
|
||||
switch( nCoord ){
|
||||
case 10: readCoord(pCellData+36, &c); aCoord[9] = c.f;
|
||||
readCoord(pCellData+32, &c); aCoord[8] = c.f;
|
||||
case 8: readCoord(pCellData+28, &c); aCoord[7] = c.f;
|
||||
readCoord(pCellData+24, &c); aCoord[6] = c.f;
|
||||
case 6: readCoord(pCellData+20, &c); aCoord[5] = c.f;
|
||||
readCoord(pCellData+16, &c); aCoord[4] = c.f;
|
||||
case 4: readCoord(pCellData+12, &c); aCoord[3] = c.f;
|
||||
readCoord(pCellData+8, &c); aCoord[2] = c.f;
|
||||
default: readCoord(pCellData+4, &c); aCoord[1] = c.f;
|
||||
readCoord(pCellData, &c); aCoord[0] = c.f;
|
||||
}
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
switch( nCoord ){
|
||||
case 10: readCoord(pCellData+36, &c); aCoord[9] = c.i;
|
||||
readCoord(pCellData+32, &c); aCoord[8] = c.i;
|
||||
case 8: readCoord(pCellData+28, &c); aCoord[7] = c.i;
|
||||
readCoord(pCellData+24, &c); aCoord[6] = c.i;
|
||||
case 6: readCoord(pCellData+20, &c); aCoord[5] = c.i;
|
||||
readCoord(pCellData+16, &c); aCoord[4] = c.i;
|
||||
case 4: readCoord(pCellData+12, &c); aCoord[3] = c.i;
|
||||
readCoord(pCellData+8, &c); aCoord[2] = c.i;
|
||||
default: readCoord(pCellData+4, &c); aCoord[1] = c.i;
|
||||
readCoord(pCellData, &c); aCoord[0] = c.i;
|
||||
}
|
||||
}
|
||||
if( pConstraint->op==RTREE_MATCH ){
|
||||
rc = pConstraint->u.xGeom((sqlite3_rtree_geometry*)pInfo,
|
||||
nCoord, aCoord, &i);
|
||||
|
Reference in New Issue
Block a user