Refactor the float-to-double rounding routines so that they compile without
warnings. FossilOrigin-Name: f607ad27c1ede27af24dbee10ca867c8f7761ee3
This commit is contained in:
parent
c6bff38216
commit
0e3037ac36
@ -2739,6 +2739,12 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Rounding constants for float->double conversion.
|
||||||
|
*/
|
||||||
|
#define RNDTOWARDS (1.0 - 1.0/8388608.0) /* Round towards zero */
|
||||||
|
#define RNDAWAY (1.0 + 1.0/8388608.0) /* Round away from zero */
|
||||||
|
|
||||||
#if !defined(SQLITE_RTREE_INT_ONLY)
|
#if !defined(SQLITE_RTREE_INT_ONLY)
|
||||||
/*
|
/*
|
||||||
** Convert an sqlite3_value into an RtreeValue (presumably a float)
|
** Convert an sqlite3_value into an RtreeValue (presumably a float)
|
||||||
@ -2748,11 +2754,7 @@ static RtreeValue rtreeValueDown(sqlite3_value *v){
|
|||||||
double d = sqlite3_value_double(v);
|
double d = sqlite3_value_double(v);
|
||||||
float f = (float)d;
|
float f = (float)d;
|
||||||
if( f>d ){
|
if( f>d ){
|
||||||
if( f<0.0 ){
|
f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS));
|
||||||
f += f/8388608.0;
|
|
||||||
}else{
|
|
||||||
f -= f/8388608.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@ -2760,11 +2762,7 @@ static RtreeValue rtreeValueUp(sqlite3_value *v){
|
|||||||
double d = sqlite3_value_double(v);
|
double d = sqlite3_value_double(v);
|
||||||
float f = (float)d;
|
float f = (float)d;
|
||||||
if( f<d ){
|
if( f<d ){
|
||||||
if( f<0.0 ){
|
f = (float)(d*(d<0 ? RNDTOWARDS : RNDAWAY));
|
||||||
f -= f/8388608.0;
|
|
||||||
}else{
|
|
||||||
f += f/8388608.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
|||||||
C Simplification\sto\sthe\scoordinate\srounding\slogic\sin\sRTree.
|
C Refactor\sthe\sfloat-to-double\srounding\sroutines\sso\sthat\sthey\scompile\swithout\nwarnings.
|
||||||
D 2012-05-28T20:16:42.392
|
D 2012-05-29T00:30:43.635
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 4f37eb61be9d38643cdd839a74b8e3bad724cfcf
|
F Makefile.in 4f37eb61be9d38643cdd839a74b8e3bad724cfcf
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@ -83,7 +83,7 @@ F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
|
|||||||
F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
|
F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
|
||||||
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c 529aad2011bdeae0e310590b523fe0a07f934906
|
F ext/rtree/rtree.c d17aecb7a92762efa7b1f5d5fd7c88fd77d70827
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
F ext/rtree/rtree1.test e474a2b5eff231496dbd073fe67e5fbaf7f444c9
|
F ext/rtree/rtree1.test e474a2b5eff231496dbd073fe67e5fbaf7f444c9
|
||||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||||
@ -1004,7 +1004,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
|||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
|
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
P f4e8ff03eae70334632455a867859cfcc25682be
|
P df24072de27555c6b530b02e821ea8b066c554fc
|
||||||
R bc6bf69f14471e3fbe5247d9db42468b
|
R f35d5b4a9dd7d1169a15c017bcaeb391
|
||||||
U drh
|
U drh
|
||||||
Z a79ca44958f115bb818431edcabdbadb
|
Z 5259b4674eededa40e2ec42b982389dc
|
||||||
|
@ -1 +1 @@
|
|||||||
df24072de27555c6b530b02e821ea8b066c554fc
|
f607ad27c1ede27af24dbee10ca867c8f7761ee3
|
Loading…
x
Reference in New Issue
Block a user