* tags.h (SCM_T_BITS_MAX, SCM_T_SIGNED_BITS_MAX,
authorMarius Vollmer <mvo@zagadka.de>
Sat, 6 Oct 2001 19:58:02 +0000 (19:58 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Sat, 6 Oct 2001 19:58:02 +0000 (19:58 +0000)
SCM_T_SIGNED_BITS_MIN): New.
* numbers.h (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM):
Use them to make these macros computable by the preprocessor.

libguile/numbers.h
libguile/tags.h

index d125781..f2a355a 100644 (file)
  *
  * Inums are exact integer data that fits within an SCM word.  */
 
-#define SCM_I_FIXNUM_BIT \
-  (SCM_LONG_BIT - 2)
-#define SCM_MOST_POSITIVE_FIXNUM \
-  ((((scm_t_signed_bits) 1) << (SCM_I_FIXNUM_BIT - 1)) - 1)
-#define SCM_MOST_NEGATIVE_FIXNUM \
-  (-((scm_t_signed_bits) SCM_MOST_POSITIVE_FIXNUM) - 1)
-
+#define SCM_I_FIXNUM_BIT         (SCM_LONG_BIT - 2)
+#define SCM_MOST_POSITIVE_FIXNUM (SCM_T_SIGNED_BITS_MAX/8-1)
+#define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
 
 /* SCM_SRS is signed right shift */
 #if (-1 == (((-1) << 2) + 2) >> 2)
index 6304a26..e8e160d 100644 (file)
 #ifdef HAVE_UINTPTR_T
 typedef uintptr_t scm_t_bits;
 typedef intptr_t scm_t_signed_bits;
+#define SCM_T_BITS_MAX UINTPTR_MAX
+#define SCM_T_SIGNED_BITS_MAX INTPTR_MAX
+#define SCM_T_SIGNED_BITS_MIN INTPTR_MIN
 #else
 typedef unsigned long scm_t_bits;
 typedef signed long scm_t_signed_bits;
+#define SCM_T_BITS_MAX ULONG_MAX
+#define SCM_T_SIGNED_BITS_MAX LONG_MAX
+#define SCM_T_SIGNED_BITS_MIN LONG_MIN
 #endif
 
 /* But as external interface, we use SCM, which may, according to the desired