From b8496c37369da7c24511a3c73bbf18972a3e7a5a Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 13 Sep 2016 20:14:17 +0100 Subject: [PATCH] Pass set size to __IN, remove uSET Ctype, optimize __IN size test. --- src/compiler/OPV.Mod | 7 +++++-- src/system/SYSTEM.h | 13 +++++++------ src/test/confidence/planned-binary-change | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/compiler/OPV.Mod b/src/compiler/OPV.Mod index 2f679ace..ef8a1394 100644 --- a/src/compiler/OPV.Mod +++ b/src/compiler/OPV.Mod @@ -624,8 +624,11 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96 IF (subclass IN {OPT.ash, OPT.lsh, OPT.rot}) & (r^.class = OPT.Nconst) & (r^.conval^.intval < 0) THEN OPM.WriteInt(-r^.conval^.intval) ELSE expr(r, MinPrec) - END ; - IF subclass IN {OPT.lsh, OPT.rot} THEN OPM.WriteString(Comma); OPM.WriteInt(l.typ.size*8) END; + END; + IF subclass IN {OPS.in, OPT.lsh, OPT.rot} THEN + OPM.WriteString(Comma); + IF subclass = OPS.in THEN OPM.WriteInt(r.typ.size*8) ELSE OPM.WriteInt(l.typ.size*8) END + END; OPM.Write(CloseParen) | OPS.eql .. OPS.geq: IF l^.typ^.form IN {OPT.String, OPT.Comp} THEN diff --git a/src/system/SYSTEM.h b/src/system/SYSTEM.h index d5f53efa..896934e7 100644 --- a/src/system/SYSTEM.h +++ b/src/system/SYSTEM.h @@ -92,7 +92,6 @@ typedef float REAL; typedef double LONGREAL; typedef void* SYSTEM_PTR; -#define uSET SET // 'address' is a synonym for an int of pointer size @@ -200,7 +199,6 @@ static inline int __str_cmp(CHAR *x, CHAR *y){ static inline int64 SYSTEM_ASH(int64 x, int64 n) {return __ASH(x,n);} #define __ASHF(x, n) SYSTEM_ASH((int64)(x), (int64)(n)) -#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) #define __MOVE(s, d, n) memcpy((char*)(address)(d),(char*)(address)(s),n) @@ -230,10 +228,13 @@ static inline double SYSTEM_ABSD(double i) {return i >= 0.0 ? i : -i;} #define __CAP(ch) ((CHAR)((ch)&0x5f)) #define __ODD(x) ((x)&1) -#define __IN(x, s) ((x)>=0 && (x)<(8*sizeof(SET)) && ((((uSET)(s))>>(x))&1)) -#define __SETOF(x) ((SET)1<<(x)) -#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) -#define __MASK(x, m) ((x)&~(m)) +//#define __IN(x, s, size) ((x)>=0 && (x)>(x))&1)) + +#define __IN(x, s, size) (((unsigned int)(x))>(x))&1)) +#define __SETOF(x) ((SET)1<<(x)) +#define __SETRNG(l, h) ((~(SET)0<<(l))&~(SET)0>>(8*sizeof(SET)-1-(h))) +#define __MASK(x, m) ((x)&~(m)) +#define __BIT(x, n) (*(uint64*)(x)>>(n)&1) diff --git a/src/test/confidence/planned-binary-change b/src/test/confidence/planned-binary-change index 601e55c7..a2fd3632 100644 --- a/src/test/confidence/planned-binary-change +++ b/src/test/confidence/planned-binary-change @@ -1 +1 @@ -12 Sep 2016 17:01:41 +13 Sep 2016 20:12:45