mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
don't arithmetic shift signed ints (fixed issue #425)
This commit is contained in:
parent
fd28b5438b
commit
8a9d8c0979
2 changed files with 9 additions and 0 deletions
|
@ -757,6 +757,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SEXP_USE_SIGNED_SHIFTS
|
||||||
|
#define SEXP_USE_SIGNED_SHIFTS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PLAN9
|
#ifdef PLAN9
|
||||||
#define strcasecmp cistrcmp
|
#define strcasecmp cistrcmp
|
||||||
#define strncasecmp cistrncmp
|
#define strncasecmp cistrncmp
|
||||||
|
|
|
@ -801,8 +801,13 @@ SEXP_API int sexp_idp(sexp x);
|
||||||
#define sexp_make_boolean(x) ((x) ? SEXP_TRUE : SEXP_FALSE)
|
#define sexp_make_boolean(x) ((x) ? SEXP_TRUE : SEXP_FALSE)
|
||||||
#define sexp_unbox_boolean(x) (((x) == SEXP_FALSE) ? 0 : 1)
|
#define sexp_unbox_boolean(x) (((x) == SEXP_FALSE) ? 0 : 1)
|
||||||
|
|
||||||
|
#if SEXP_USE_SIGNED_SHIFTS
|
||||||
#define sexp_make_fixnum(n) ((sexp) ((((sexp_sint_t)(n))<<SEXP_FIXNUM_BITS) + SEXP_FIXNUM_TAG))
|
#define sexp_make_fixnum(n) ((sexp) ((((sexp_sint_t)(n))<<SEXP_FIXNUM_BITS) + SEXP_FIXNUM_TAG))
|
||||||
#define sexp_unbox_fixnum(n) (((sexp_sint_t)(n))>>SEXP_FIXNUM_BITS)
|
#define sexp_unbox_fixnum(n) (((sexp_sint_t)(n))>>SEXP_FIXNUM_BITS)
|
||||||
|
#else
|
||||||
|
#define sexp_make_fixnum(n) ((sexp) ((((sexp_sint_t)(n))*(sexp_sint_t)(1uL<<SEXP_FIXNUM_BITS)) | SEXP_FIXNUM_TAG))
|
||||||
|
#define sexp_unbox_fixnum(n) (((sexp_sint_t)((sexp_uint_t)(n) & ~SEXP_FIXNUM_TAG))/(sexp_sint_t)(1uL<<SEXP_FIXNUM_BITS))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SEXP_NEG_ONE sexp_make_fixnum(-1)
|
#define SEXP_NEG_ONE sexp_make_fixnum(-1)
|
||||||
#define SEXP_ZERO sexp_make_fixnum(0)
|
#define SEXP_ZERO sexp_make_fixnum(0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue