[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile 1.5.8 beta available for testing.
From: |
Lars J. Aas |
Subject: |
Re: Guile 1.5.8 beta available for testing. |
Date: |
Mon, 2 Sep 2002 13:38:18 +0200 |
User-agent: |
Mutt/1.3.24i |
Marius Vollmer <address@hidden> wrote:
: "Lars J. Aas" <address@hidden> writes:
:
: > : A fix would be to move the scm_t_signed_bits cast one level up, and
: > : also in SCM_MOST_NEGATIVE_FIXNUM. We should do that and put a
: > : deriding comment about MS on the code. OK?
: >
: > Sounds reasonable.
:
: However, in CVS HEAD, we use these definitions, to make them
: computable by the preprocessor:
:
: #define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2)
: #define SCM_MOST_POSITIVE_FIXNUM ((SCM_T_SIGNED_BITS_MAX-3)/4)
: #define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
:
: Does this work as well?
Yes, the following snippet works out of the box with no tweaks
necessary for the defines.
Lars J
----------------------------------------------------------------------------
#include <stdio.h>
#include <limits.h>
typedef signed long scm_t_signed_bits;
#ifdef LONG_BIT
# define SCM_LONG_BIT LONG_BIT
#else
# define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char))
#endif
#define SCM_T_SIGNED_BITS_MAX LONG_MAX
#define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2)
#define SCM_MOST_POSITIVE_FIXNUM ((SCM_T_SIGNED_BITS_MAX-3)/4)
#define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
#define SCM_POSFIXABLE(n) ((n) <= SCM_MOST_POSITIVE_FIXNUM)
int
main(int argc, char ** argv)
{
int val;
fprintf(stderr, "test 1 - ");
if ( SCM_POSFIXABLE(-1) ) fprintf(stderr, "success\n");
else fprintf(stderr, "failure\n");
fprintf(stderr, "test 2 - ");
val = -1;
if ( SCM_POSFIXABLE(val) ) fprintf(stderr, "success\n");
else fprintf(stderr, "failure\n");
return 0;
}
- Re: Guile 1.5.8 beta available for testing.,
Lars J. Aas <=
Re: Guile 1.5.8 beta available for testing., Sven Hartrumpf, 2002/09/03