Avoid clang warnings about undefined signed shift behavior

Calls to fixnum(-1) would cause them.
This commit is contained in:
Lassi Kortela 2019-08-09 14:06:36 +03:00
parent b128aee83d
commit 82e09fa92b
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@
typedef uptrint_t value_t; typedef uptrint_t value_t;
typedef int_t fixnum_t; typedef int_t fixnum_t;
typedef uint_t ufixnum_t;
#ifdef BITS64 #ifdef BITS64
#define T_FIXNUM T_INT64 #define T_FIXNUM T_INT64
#else #else
@ -52,7 +53,7 @@ typedef struct {
#define tag(x) ((x)&0x7) #define tag(x) ((x)&0x7)
#define ptr(x) ((void *)((x) & (~(value_t)0x7))) #define ptr(x) ((void *)((x) & (~(value_t)0x7)))
#define tagptr(p, t) (((value_t)(p)) | (t)) #define tagptr(p, t) (((value_t)(p)) | (t))
#define fixnum(x) ((value_t)(((fixnum_t)(x)) << 2)) #define fixnum(x) ((value_t)(((ufixnum_t)(fixnum_t)(x)) << 2))
#define numval(x) (((fixnum_t)(x)) >> 2) #define numval(x) (((fixnum_t)(x)) >> 2)
#ifdef BITS64 #ifdef BITS64
#define fits_fixnum(x) (((x) >> 61) == 0 || (~((x) >> 61)) == 0) #define fits_fixnum(x) (((x) >> 61) == 0 || (~((x) >> 61)) == 0)