Unwind the RTREE dimension loop inside of rtreeCallbackConstraint().

FossilOrigin-Name: 4854ea9c18e7d8066c90b41568d0fae97b01ea6d
This commit is contained in:
drh 2017-02-01 17:08:56 +00:00
parent 5db59b33c4
commit 31a1349515
3 changed files with 39 additions and 16 deletions

View File

@ -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);

View File

@ -1,5 +1,5 @@
C Completely\sunroll\sthe\sdimension\sloop\sinside\sof\scellArea()\sin\sRTREE.
D 2017-02-01T16:41:30.471
C Unwind\sthe\sRTREE\sdimension\sloop\sinside\sof\srtreeCallbackConstraint().
D 2017-02-01T17:08:56.249
F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -264,7 +264,7 @@ F ext/rbu/sqlite3rbu.c bb0de6cdbdb14a7d55a097238a434b7e99caf318
F ext/rbu/sqlite3rbu.h 6fb6294c34a9ca93b5894a33bca530c6f08decba
F ext/rbu/test_rbu.c 5aa22616afac6f71ebd3d9bc9bf1006cfabcca88
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 60df707ce5ae232351fc7fc8e916738b1a06bf26
F ext/rtree/rtree.c f2c8604fcdbe13f960c5f0b97acbc2a870b72bf2
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
F ext/rtree/rtree1.test 42dadfc7b44a436cd74a1bebc0b9b689e4eaf7ec
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@ -1552,7 +1552,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f1f3c8cc733a05c12dd980f2dfa0ab4ccd76c04b
R f244aabca54009b102530102725b0e43
P 3c4c0126c287f844220b65e00fec17c059fbb7c8
R f35bf88856ef1a64759d9b647928073d
U drh
Z 396b9b4a99bf06a5c73ba01696403f75
Z 9add4b4d28dce63431ad3a0684bb5601

View File

@ -1 +1 @@
3c4c0126c287f844220b65e00fec17c059fbb7c8
4854ea9c18e7d8066c90b41568d0fae97b01ea6d