1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Added macros to convert between 32-bit ints and 64-bit ptrs to avoid compiler warnings. (CVS 5378)

FossilOrigin-Name: 6cdb6841ff4683e424ef394733da9c24f5602570
This commit is contained in:
shane
2008-07-08 22:28:48 +00:00
parent c6f66c5349
commit 1fc4129df7
10 changed files with 49 additions and 33 deletions

View File

@@ -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