diff --git a/manifest b/manifest index 5162054073..20008a5943 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rework\saccessPayload()\sfunction\sfor\sclarity.\s(CVS\s3912) -D 2007-05-04T08:32:14 +C Add\scompile-time\soption\s-DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1\sthat\suses\nmixed-endian\sdoubles.\s\sThis\sis\sneeded\son\sARM7\sto\smake\sdatabase\sfile\nformats\scompatible\swith\sall\sother\sprocessors.\s\sTickets\s#2278\sand\s#2335.\s(CVS\s3913) +D 2007-05-04T11:59:32 F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -99,7 +99,7 @@ F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 762c81655da0f01067514924a5ba8f47a47ada1d F src/sqlite.h.in a666300976897eced975b448f722a722b362c6b1 F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890 -F src/sqliteInt.h 0b14d0eae083aafca0562d2261a404e5e5abc5f0 +F src/sqliteInt.h 5a8c0221a4f11998f46aa76364a9559af8d7c1f7 F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06 F src/tclsqlite.c dde509871614d17f8ab5f3b4bc496b0af07280c7 F src/test1.c 29a39fdde51f4612082ecf3f5af54dac93766f87 @@ -129,7 +129,7 @@ F src/vdbe.c a4abf744b5376372a9be30f02ab4b231f353cab1 F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691 F src/vdbeInt.h cb02cbbceddf3b40d49012e9f41576f17bcbec97 F src/vdbeapi.c 37d793559390bec8a00c556f651f21b5f9e589af -F src/vdbeaux.c 8c7f22e22d1ea578971f5a3fcd3a56a6882ced64 +F src/vdbeaux.c 51acaab4275b5fddc7af5e7d1d2594044216ac46 F src/vdbeblob.c ed2f9b46cc2de8de97d2a4a4ec466c5914d68333 F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f F src/vdbemem.c ba98f8572ec4609846b368fa7580db178022f1bb @@ -473,7 +473,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P e54a49e264ecd54083587f8d3b17cce4c811fddc -R 6675084e0bd9661ee80adf52bdde8264 -U danielk1977 -Z cda47f0f1385e7692b319bbdf6df8c16 +P 42d07c70ec1eb6dd9619c97d753c9d2824aeae32 +R f96d594e26c58bcc8fee62b7bf4c7bdc +U drh +Z 47fadba21691b4be40e7c985b1254595 diff --git a/manifest.uuid b/manifest.uuid index fc5cbf80a5..65746c509a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -42d07c70ec1eb6dd9619c97d753c9d2824aeae32 \ No newline at end of file +2a178d0c7950c9d403c0bc43c2043de945fb24e0 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 8721cd53ef..c2f841d1af 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.553 2007/04/26 14:42:36 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.554 2007/05/04 11:59:32 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -75,6 +75,7 @@ # endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 +# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT #endif #ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (1e99) diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b3f903c34c..83fe3e9fe1 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1767,6 +1767,32 @@ int sqlite3VdbeSerialTypeLen(u32 serial_type){ } } +/* +** If we are on an architecture with mixed-endian floating +*** points (ex: ARM7) then swap the lower 4 bytes with the +** upper 4 bytes. Return the result. +** +** For most (sane) architectures, this is a no-op. +*/ +#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT +static double floatSwap(double in){ + union { + double r; + u32 i[2]; + } u; + u32 t; + + u.r = in; + t = u.i[0]; + u.i[0] = u.i[1]; + u.i[1] = t; + return u.r; +} +# define swapMixedEndianFloat(X) X = floatSwap(X) +#else +# define swapMixedEndianFloat(X) +#endif + /* ** Write the serialized data blob for the value stored in pMem into ** buf. It is assumed that the caller has allocated sufficient space. @@ -1795,6 +1821,7 @@ int sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){ int i; if( serial_type==7 ){ assert( sizeof(v)==sizeof(pMem->r) ); + swapMixedEndianFloat(pMem->r); memcpy(&v, &pMem->r, sizeof(v)); }else{ v = pMem->u.i; @@ -1879,11 +1906,15 @@ int sqlite3VdbeSerialGet( u32 y; #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT) /* Verify that integers and floating point values use the same - ** byte order. The byte order differs on some (broken) architectures. + ** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is + ** defined that 64-bit floating point values really are mixed + ** endian. */ static const u64 t1 = ((u64)0x3ff00000)<<32; static const double r1 = 1.0; - assert( sizeof(r1)==sizeof(t1) && memcmp(&r1, &t1, sizeof(r1))==0 ); + double r2 = r1; + swapMixedEndianFloat(r2); + assert( sizeof(r2)==sizeof(t1) && memcmp(&r2, &t1, sizeof(r1))==0 ); #endif x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3]; @@ -1895,7 +1926,7 @@ int sqlite3VdbeSerialGet( }else{ assert( sizeof(x)==8 && sizeof(pMem->r)==8 ); memcpy(&pMem->r, &x, sizeof(x)); - /* pMem->r = *(double*)&x; */ + swapMixedEndianFloat(pMem->r); pMem->flags = MEM_Real; } return 8;