]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Unwind the RTREE dimension loop inside of rtreeCallbackConstraint().
authordrh <drh@noemail.net>
Wed, 1 Feb 2017 17:08:56 +0000 (17:08 +0000)
committerdrh <drh@noemail.net>
Wed, 1 Feb 2017 17:08:56 +0000 (17:08 +0000)
FossilOrigin-Name: 4854ea9c18e7d8066c90b41568d0fae97b01ea6d

ext/rtree/rtree.c
manifest
manifest.uuid

index 4d67d6704471a76523539970ff909b0ae2a55bf3..ac76c18485e835ad84e7eed755f867cf7177aef5 100644 (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);
index 62887ba81435f8f9f2a11c965d78f95a6698da43..8bb675991a7565e7d3069eccd1d236c705d4f708 100644 (file)
--- a/manifest
+++ b/manifest
@@ -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
index a4a1237e470111c89152e9610adb2bf7faa14ba4..8728c8d9a3e214dbd133acdddb5bd9184eadb2a1 100644 (file)
@@ -1 +1 @@
-3c4c0126c287f844220b65e00fec17c059fbb7c8
\ No newline at end of file
+4854ea9c18e7d8066c90b41568d0fae97b01ea6d
\ No newline at end of file