Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add compile-time option -DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1 that uses mixed-endian doubles. This is needed on ARM7 to make database file formats compatible with all other processors. Tickets #2278 and #2335. (CVS 3913) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2a178d0c7950c9d403c0bc43c2043de9 |
User & Date: | drh 2007-05-04 11:59:32.000 |
Context
2007-05-04
| ||
12:01 | Fix a formatting errror in I/O logging. (CVS 3914) (check-in: 2d37687a08 user: drh tags: trunk) | |
11:59 | Add compile-time option -DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1 that uses mixed-endian doubles. This is needed on ARM7 to make database file formats compatible with all other processors. Tickets #2278 and #2335. (CVS 3913) (check-in: 2a178d0c79 user: drh tags: trunk) | |
08:32 | Rework accessPayload() function for clarity. (CVS 3912) (check-in: 42d07c70ec user: danielk1977 tags: trunk) | |
Changes
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.554 2007/05/04 11:59:32 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ #if defined(SQLITE_TCL) || defined(TCLSH) # include <tcl.h> #endif |
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | # define double sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 # ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (0x7fffffffffffffff) # endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 #endif #ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (1e99) #endif /* ** The maximum number of in-memory pages to use for the main database | > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | # define double sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 # ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (0x7fffffffffffffff) # 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) #endif /* ** The maximum number of in-memory pages to use for the main database |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 | return (serial_type-12)/2; }else{ static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 }; return aSize[serial_type]; } } /* ** Write the serialized data blob for the value stored in pMem into ** buf. It is assumed that the caller has allocated sufficient space. ** Return the number of bytes written. ** ** nBuf is the amount of space left in buf[]. nBuf must always be ** large enough to hold the entire field. Except, if the field is | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 | return (serial_type-12)/2; }else{ static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 }; return aSize[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. ** Return the number of bytes written. ** ** nBuf is the amount of space left in buf[]. nBuf must always be ** large enough to hold the entire field. Except, if the field is |
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | /* Integer and Real */ if( serial_type<=7 && serial_type>0 ){ u64 v; int i; if( serial_type==7 ){ assert( sizeof(v)==sizeof(pMem->r) ); memcpy(&v, &pMem->r, sizeof(v)); }else{ v = pMem->u.i; } len = i = sqlite3VdbeSerialTypeLen(serial_type); assert( len<=nBuf ); while( i-- ){ | > | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | /* Integer and Real */ if( serial_type<=7 && serial_type>0 ){ u64 v; 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; } len = i = sqlite3VdbeSerialTypeLen(serial_type); assert( len<=nBuf ); while( i-- ){ |
︙ | ︙ | |||
1875 1876 1877 1878 1879 1880 1881 | } case 6: /* 8-byte signed integer */ case 7: { /* IEEE floating point */ u64 x; u32 y; #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT) /* Verify that integers and floating point values use the same | | > > > > | | | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 | } case 6: /* 8-byte signed integer */ case 7: { /* IEEE floating point */ u64 x; u32 y; #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT) /* Verify that integers and floating point values use the same ** 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; 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]; y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7]; x = (x<<32) | y; if( serial_type==6 ){ pMem->u.i = *(i64*)&x; pMem->flags = MEM_Int; }else{ assert( sizeof(x)==8 && sizeof(pMem->r)==8 ); memcpy(&pMem->r, &x, sizeof(x)); swapMixedEndianFloat(pMem->r); pMem->flags = MEM_Real; } return 8; } case 8: /* Integer 0 */ case 9: { /* Integer 1 */ pMem->u.i = serial_type-8; |
︙ | ︙ |