mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* Cleaned up some limits-definitions.
This commit is contained in:
parent
339bfe47a1
commit
5c75b29f1d
3 changed files with 54 additions and 34 deletions
|
@ -1,3 +1,18 @@
|
|||
2001-01-18 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* __scm.h: Added comment about architecture and compiler
|
||||
properties that are required by guile.
|
||||
|
||||
(SCM_FIXNUM_BIT, SCM_MOST_POSITIVE_FIXNUM,
|
||||
SCM_MOST_NEGATIVE_FIXNUM): Moved to numbers.h.
|
||||
|
||||
(SCM_CHAR_BIT, SCM_LONG_BIT): Moved here from numbers.h.
|
||||
|
||||
* numbers.h (SCM_CHAR_BIT, SCM_LONG_BIT): Moved to __scm.h.
|
||||
|
||||
(SCM_FIXNUM_BIT, SCM_MOST_POSITIVE_FIXNUM,
|
||||
SCM_MOST_NEGATIVE_FIXNUM): Moved here from __scm.h.
|
||||
|
||||
2001-01-17 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* __scm.h (SCM_FIXNUM_BIT): Added. The name is chosen in analogy
|
||||
|
|
|
@ -203,37 +203,46 @@ typedef unsigned long long ulong_long;
|
|||
|
||||
|
||||
|
||||
/* Define
|
||||
/* {Architecture and compiler properties}
|
||||
*
|
||||
* SCM_CHAR_CODE_LIMIT == UCHAR_MAX + 1
|
||||
* SCM_MOST_POSITIVE_FIXNUM (LONG_MAX>>2)
|
||||
* SCM_MOST_NEGATIVE_FIXNUM == SCM_SRS((long)LONG_MIN, 2)
|
||||
* Guile as of today can only work on systems which fulfill at least the
|
||||
* following requirements:
|
||||
* - long ints have at least 32 bits.
|
||||
* Guile's type system is based on this assumption.
|
||||
* - long ints consist of at least four characters.
|
||||
* It is assumed that cells, i. e. pairs of long ints, are eight character
|
||||
* aligned, because three bits of a cell pointer are used for type data.
|
||||
* - sizeof (void*) == sizeof (long int)
|
||||
* Pointers are stored in SCM objects, and sometimes SCM objects are passed
|
||||
* as void*. Thus, there has to be a one-to-one correspondence.
|
||||
* - numbers are encoded using two's complement.
|
||||
* The implementation of the bitwise scheme level operations is based on
|
||||
* this assumption.
|
||||
* - ... add more
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
# ifdef UCHAR_MAX
|
||||
# define SCM_CHAR_CODE_LIMIT (UCHAR_MAX+1L)
|
||||
# else
|
||||
# define SCM_CHAR_CODE_LIMIT 256L
|
||||
# endif /* def UCHAR_MAX */
|
||||
# define SCM_FIXNUM_BIT (LONG_BIT - 2)
|
||||
# define SCM_MOST_POSITIVE_FIXNUM (LONG_MAX>>2)
|
||||
# ifdef _UNICOS /* Stupid cray bug */
|
||||
# define SCM_MOST_NEGATIVE_FIXNUM ((long)LONG_MIN/4)
|
||||
# else
|
||||
# define SCM_MOST_NEGATIVE_FIXNUM SCM_SRS((long)LONG_MIN, 2)
|
||||
# endif /* UNICOS */
|
||||
#endif
|
||||
|
||||
#ifdef CHAR_BIT
|
||||
# define SCM_CHAR_BIT CHAR_BIT
|
||||
#else
|
||||
# define SCM_CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifdef LONG_BIT
|
||||
# define SCM_LONG_BIT LONG_BIT
|
||||
#else
|
||||
# define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char))
|
||||
#endif
|
||||
|
||||
#ifdef UCHAR_MAX
|
||||
# define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L)
|
||||
#else
|
||||
# define SCM_CHAR_CODE_LIMIT 256L
|
||||
# define SCM_FIXNUM_BIT 30
|
||||
# define SCM_MOST_POSITIVE_FIXNUM ((long)((unsigned long)~0L>>3))
|
||||
# if (0 != ~0)
|
||||
# define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
|
||||
# else
|
||||
# define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM)
|
||||
# endif /* (0 != ~0) */
|
||||
#endif /* def HAVE_LIMITS_H */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
/* Immediate Numbers
|
||||
*
|
||||
* Inums are exact integer data that fits within an SCM word.
|
||||
|
@ -63,6 +62,11 @@
|
|||
* SCM_INUMP (SCM_CAR (x)) can give wrong answers.
|
||||
*/
|
||||
|
||||
#define SCM_FIXNUM_BIT (SCM_LONG_BIT - 2)
|
||||
#define SCM_MOST_POSITIVE_FIXNUM ((1L << (SCM_FIXNUM_BIT - 1)) - 1)
|
||||
#define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM - 1)
|
||||
|
||||
|
||||
/* SCM_SRS is signed right shift */
|
||||
#if (-1 == (((-1) << 2) + 2) >> 2)
|
||||
# define SCM_SRS(x, y) ((x) >> (y))
|
||||
|
@ -111,15 +115,7 @@
|
|||
/* SCM_INTBUFLEN is the maximum number of characters neccessary for the
|
||||
* printed or scm_string representation of an exact immediate.
|
||||
*/
|
||||
|
||||
#ifndef SCM_CHAR_BIT
|
||||
# define SCM_CHAR_BIT 8
|
||||
#endif /* ndef SCM_CHAR_BIT */
|
||||
#ifndef SCM_LONG_BIT
|
||||
# define SCM_LONG_BIT (SCM_CHAR_BIT*sizeof(long)/sizeof(char))
|
||||
#endif /* ndef SCM_LONG_BIT */
|
||||
#define SCM_INTBUFLEN (5+SCM_LONG_BIT)
|
||||
|
||||
#define SCM_INTBUFLEN (5 + SCM_LONG_BIT)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue