Revise Bitvec struct sizing to prevent assertion failure on 64-bit systems (CVS 4862)

FossilOrigin-Name: a3c12dbe95c8fb93f5b9006bf5d2c5b933fc5e87
diff --git a/src/bitvec.c b/src/bitvec.c
index 23a002c..7fa8a8a 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -32,16 +32,19 @@
 ** start of a transaction, and is thus usually less than a few thousand,
 ** but can be as large as 2 billion for a really big database.
 **
-** @(#) $Id: bitvec.c,v 1.1 2008/02/18 14:47:34 drh Exp $
+** @(#) $Id: bitvec.c,v 1.2 2008/03/14 13:02:08 mlcreech Exp $
 */
 #include "sqliteInt.h"
 
 #define BITVEC_SZ        512
-#define BITVEC_NCHAR     (BITVEC_SZ-12)
+/* Round the union size down to the nearest pointer boundary, since that's how 
+** it will be aligned within the Bitvec struct. */
+#define BITVEC_USIZE     (((BITVEC_SZ-12)/sizeof(Bitvec *))*sizeof(Bitvec *))
+#define BITVEC_NCHAR     BITVEC_USIZE
 #define BITVEC_NBIT      (BITVEC_NCHAR*8)
-#define BITVEC_NINT      ((BITVEC_SZ-12)/4)
+#define BITVEC_NINT      (BITVEC_USIZE/4)
 #define BITVEC_MXHASH    (BITVEC_NINT/2)
-#define BITVEC_NPTR      ((BITVEC_SZ-12)/8)
+#define BITVEC_NPTR      (BITVEC_USIZE/sizeof(Bitvec *))
 
 #define BITVEC_HASH(X)   (((X)*37)%BITVEC_NINT)
 
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 6e26518..bf87c74 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.672 2008/03/10 16:17:59 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.673 2008/03/14 13:02:08 mlcreech Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -314,19 +314,39 @@
 **         cc '-DUINTPTR_TYPE=long long int' ...
 */
 #ifndef UINT32_TYPE
-# define UINT32_TYPE unsigned int
+# ifdef HAVE_UINT32_T
+#  define UINT32_TYPE uint32_t
+# else
+#  define UINT32_TYPE unsigned int
+# endif
 #endif
 #ifndef UINT16_TYPE
-# define UINT16_TYPE unsigned short int
+# ifdef HAVE_UINT16_T
+#  define UINT16_TYPE uint16_t
+# else
+#  define UINT16_TYPE unsigned short int
+# endif
 #endif
 #ifndef INT16_TYPE
-# define INT16_TYPE short int
+# ifdef HAVE_INT16_T
+#  define INT16_TYPE int16_t
+# else
+#  define INT16_TYPE short int
+# endif
 #endif
 #ifndef UINT8_TYPE
-# define UINT8_TYPE unsigned char
+# ifdef HAVE_UINT8_T
+#  define UINT8_TYPE uint8_t
+# else
+#  define UINT8_TYPE unsigned char
+# endif
 #endif
 #ifndef INT8_TYPE
-# define INT8_TYPE signed char
+# ifdef HAVE_INT8_T
+#  define INT8_TYPE int8_t
+# else
+#  define INT8_TYPE signed char
+# endif
 #endif
 #ifndef LONGDOUBLE_TYPE
 # define LONGDOUBLE_TYPE long double