1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

* tags.h (SCM_T_BITS_MAX, SCM_T_SIGNED_BITS_MAX,

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.
This commit is contained in:
Marius Vollmer 2001-10-06 19:58:02 +00:00
parent 152812c057
commit 004c0902ff
2 changed files with 9 additions and 7 deletions

View file

@ -55,13 +55,9 @@
* *
* Inums are exact integer data that fits within an SCM word. */ * Inums are exact integer data that fits within an SCM word. */
#define SCM_I_FIXNUM_BIT \ #define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2)
(SCM_LONG_BIT - 2) #define SCM_MOST_POSITIVE_FIXNUM (SCM_T_SIGNED_BITS_MAX/8-1)
#define SCM_MOST_POSITIVE_FIXNUM \ #define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
((((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)
/* SCM_SRS is signed right shift */ /* SCM_SRS is signed right shift */
#if (-1 == (((-1) << 2) + 2) >> 2) #if (-1 == (((-1) << 2) + 2) >> 2)

View file

@ -65,9 +65,15 @@
#ifdef HAVE_UINTPTR_T #ifdef HAVE_UINTPTR_T
typedef uintptr_t scm_t_bits; typedef uintptr_t scm_t_bits;
typedef intptr_t scm_t_signed_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 #else
typedef unsigned long scm_t_bits; typedef unsigned long scm_t_bits;
typedef signed long scm_t_signed_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 #endif
/* But as external interface, we use SCM, which may, according to the desired /* But as external interface, we use SCM, which may, according to the desired