Fix builds on 64-bit platforms (x86_64, alpha, etc.).
authorLudovic Courtès <ludo@gnu.org>
Mon, 20 Apr 2009 20:53:38 +0000 (20 22:53 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 20 Apr 2009 20:53:38 +0000 (20 22:53 +0200)
* src/bytevector.c (INT32_T_signed, INT32_T_unsigned, is_signed_int32,
  is_unsigned_int32): New macros.
  (GENERIC_INTEGER_ACCESSOR_PROLOGUE): Turn `c_len', `c_index', and
  `c_size' into `unsigned long's.

NEWS
src/bytevector.c

diff --git a/NEWS b/NEWS
index ba6f7f8..794fb8e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ were mandatory.
 *** New `make-custom-binary-output-port' procedure
 
 ** Bug fixes
+*** Fix builds on 64-bit platforms
 *** Fix custom binary input ports for Guile >= 1.8.6
 *** Fix `bytevector->{sint,uint}-list' for SIZE > bytevector length
 *** Add missing `STATUS' file
index 9d449aa..94a6c4f 100644 (file)
 #define INT8_T_unsigned         scm_t_uint8
 #define INT16_T_signed          scm_t_int16
 #define INT16_T_unsigned        scm_t_uint16
+#define INT32_T_signed          scm_t_int32
+#define INT32_T_unsigned        scm_t_uint32
 #define is_signed_int8(_x)      (((_x) >= -128L) && ((_x) <= 127L))
 #define is_unsigned_int8(_x)    ((_x) <= 255UL)
 #define is_signed_int16(_x)     (((_x) >= -32768L) && ((_x) <= 32767L))
 #define is_unsigned_int16(_x)   ((_x) <= 65535UL)
+#define is_signed_int32(_x)     (((_x) >= -2147483648L) && ((_x) <= 2147483647L))
+#define is_unsigned_int32(_x)   ((_x) <= 4294967295UL)
 #define SIGNEDNESS_signed       1
 #define SIGNEDNESS_unsigned     0
 
@@ -726,12 +730,12 @@ bytevector_large_set (char *c_bv, size_t c_size, int signed_p,
 }
 
 #define GENERIC_INTEGER_ACCESSOR_PROLOGUE(_sign)                       \
-  unsigned c_len, c_index, c_size;                                     \
+  unsigned long c_len, c_index, c_size;                                        \
   char *c_bv;                                                          \
                                                                        \
   SCM_VALIDATE_R6RS_BYTEVECTOR (1, bv);                                        \
-  c_index = scm_to_uint (index);                                       \
-  c_size = scm_to_uint (size);                                         \
+  c_index = scm_to_ulong (index);                                      \
+  c_size = scm_to_ulong (size);                                                \
                                                                        \
   c_len = SCM_R6RS_BYTEVECTOR_LENGTH (bv);                             \
   c_bv = (char *) SCM_R6RS_BYTEVECTOR_CONTENTS (bv);                   \