1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Simplification to the coordinate rounding logic in RTree.

FossilOrigin-Name: df24072de27555c6b530b02e821ea8b066c554fc
This commit is contained in:
drh
2012-05-28 20:16:42 +00:00
parent 7923863602
commit c6bff38216
3 changed files with 10 additions and 18 deletions

View File

@ -2739,14 +2739,12 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){
return rc;
}
#if !defined(SQLITE_RTREE_INT_ONLY)
/*
** Convert an sqlite3_value into an RtreeValue (presumably a float)
** while taking care to round toward negative or positive, respectively.
*/
static RtreeValue rtreeValueDown(sqlite3_value *v){
#ifdef SQLITE_RTREE_INT_ONLY
return (RtreeValue)sqlite3_value_double(v);
#else
double d = sqlite3_value_double(v);
float f = (float)d;
if( f>d ){
@ -2757,12 +2755,8 @@ static RtreeValue rtreeValueDown(sqlite3_value *v){
}
}
return f;
#endif
}
static RtreeValue rtreeValueUp(sqlite3_value *v){
#ifdef SQLITE_RTREE_INT_ONLY
return (RtreeValue)sqlite3_value_double(v);
#else
double d = sqlite3_value_double(v);
float f = (float)d;
if( f<d ){
@ -2773,8 +2767,9 @@ static RtreeValue rtreeValueUp(sqlite3_value *v){
}
}
return f;
#endif
}
#endif /* !defined(SQLITE_RTREE_INT_ONLY) */
/*
** The xUpdate method for rtree module virtual tables.