aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authorshane <shane@noemail.net>2008-07-08 22:28:48 +0000
committershane <shane@noemail.net>2008-07-08 22:28:48 +0000
commit1fc4129df7b6a304f050a5aadfaed4196fbd014e (patch)
tree824187b97d42e73531a7ad2bf0b84e3de0c2e1fc /src/sqliteInt.h
parentc6f66c534914647794b1d2167b2f1e2d92aa0fa0 (diff)
downloadsqlite-1fc4129df7b6a304f050a5aadfaed4196fbd014e.tar.gz
sqlite-1fc4129df7b6a304f050a5aadfaed4196fbd014e.zip
Added macros to convert between 32-bit ints and 64-bit ptrs to avoid compiler warnings. (CVS 5378)
FossilOrigin-Name: 6cdb6841ff4683e424ef394733da9c24f5602570
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index e56f6f514..103fd04fe 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.736 2008/07/08 19:34:07 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.737 2008/07/08 22:28:49 shane Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -77,6 +77,22 @@
# define unlikely(X) !!(X)
#endif
+/*
+ * This macro is used to "hide" some ugliness in casting an int
+ * value to a ptr value under the MSVC 64-bit compiler. Casting
+ * non 64-bit values to ptr types results in a "hard" error with
+ * the MSVC 64-bit compiler which this attempts to avoid.
+ *
+ * A simple compiler pragma or casting sequence could not be found
+ * to correct this in all situations, so this macro was introduced.
+ *
+ * It could be argued that the intptr_t type could be used in this
+ * case, but that type is not available on all compilers, or
+ * requires the #include of specific headers which differs between
+ * platforms.
+ */
+#define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
+#define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
/*
** These #defines should enable >2GB file support on Posix if the