aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-04-18 00:49:29 +0000
committerdrh <drh@noemail.net>2014-04-18 00:49:29 +0000
commit71794dbaeb73f594ef704fa265715b207f98edc7 (patch)
tree1d6f19502f186c633c22a4acccc3f29df91b66af
parent2cf4acbd9f774e1c7bbaa232edbbdf93cff553ee (diff)
downloadsqlite-71794dbaeb73f594ef704fa265715b207f98edc7.tar.gz
sqlite-71794dbaeb73f594ef704fa265715b207f98edc7.zip
Add the SQLITE_RUNTIME_BYTEORDER compile-time option to force SQLite to check
the processor byte-order at run-time. Add additional compile-time byte order checks for ARM, PPC, and SPARC. FossilOrigin-Name: 2c5363873a6f990a0abaacac6303acd46b48befc
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--src/sqliteInt.h24
3 files changed, 26 insertions, 12 deletions
diff --git a/manifest b/manifest
index a1452995b..97b4f2b46 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sSQLITE_TESTCTRL_BYTEORDER\stest\scontrol\sto\sinterrogate\sSQLite's\snotion\nof\sthe\sprocessor\sbyte\sorder\sand\swhether\sthe\sbyte\sorder\sis\sknown\sat\scompile-time\nor\sdetermined\sat\srun-time.
-D 2014-04-18T00:06:02.110
+C Add\sthe\sSQLITE_RUNTIME_BYTEORDER\scompile-time\soption\sto\sforce\sSQLite\sto\scheck\nthe\sprocessor\sbyte-order\sat\srun-time.\s\sAdd\sadditional\scompile-time\sbyte\sorder\nchecks\sfor\sARM,\sPPC,\sand\sSPARC.
+D 2014-04-18T00:49:29.419
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -222,7 +222,7 @@ F src/shell.c 2afe7a7154e97be0c74c5feacf09626bda8493be
F src/sqlite.h.in bde98816e1ba0c9ffef50afe7b32f4e5a8f54fe0
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
-F src/sqliteInt.h 35a265ef6e137e9af289d6e3b55745323148ad66
+F src/sqliteInt.h d3ca0bdd6743c9af2f333cb372b4bf95b19cd1fd
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -1160,7 +1160,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P c6fa8d0d82805be230f672eabccdfa5680d4ddfd
-R f2d9932522491a86ed313bf5e3a1693d
+P 9c6961967ae00e563ebe2859eaf2639a79f2cb01
+R 1b4cbcab83595d3a8147d0a70e1ae961
U drh
-Z 4f6d25a564bc084e4d5fbc71ec75b6b1
+Z a694f54c65c4a003c92caa29b70309b3
diff --git a/manifest.uuid b/manifest.uuid
index c03388d6d..05a8b60e7 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-9c6961967ae00e563ebe2859eaf2639a79f2cb01 \ No newline at end of file
+2c5363873a6f990a0abaacac6303acd46b48befc \ No newline at end of file
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 2a12466a4..8197a61eb 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -546,21 +546,35 @@ typedef INT16_TYPE LogEst;
/*
** Macros to determine whether the machine is big or little endian,
-** evaluated at runtime.
+** and whether or not that determination is run-time or compile-time.
+**
+** For best performance, an attempt is made to guess at the byte-order
+** using C-preprocessor macros. If that is unsuccessful, or if
+** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined
+** at run-time.
*/
#ifdef SQLITE_AMALGAMATION
const int sqlite3one = 1;
#else
extern const int sqlite3one;
#endif
-#if defined(i386) || defined(__i386__) || defined(_M_IX86) \
- || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \
- || defined(_M_AMD64) || defined(_M_ARM) || defined(__x86)
+#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
+ defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)
# define SQLITE_BYTEORDER 1234
# define SQLITE_BIGENDIAN 0
# define SQLITE_LITTLEENDIAN 1
# define SQLITE_UTF16NATIVE SQLITE_UTF16LE
-#else
+#endif
+#if (defined(sparc) || defined(__ppc__)) \
+ && !defined(SQLITE_RUNTIME_BYTEORDER)
+# define SQLITE_BYTEORDER 4321
+# define SQLITE_BIGENDIAN 1
+# define SQLITE_LITTLEENDIAN 0
+# define SQLITE_UTF16NATIVE SQLITE_UTF16BE
+#endif
+#if !defined(SQLITE_BYTEORDER)
# define SQLITE_BYTEORDER 0 /* 0 means "unknown at compile-time" */
# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)