mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
Result of shift operation on signed integers is bad.
This commit is contained in:
parent
f281de7a3c
commit
e02ebfe486
3 changed files with 3 additions and 4 deletions
1
Makefile
1
Makefile
|
@ -162,7 +162,6 @@ SPLINTFLAGS = \
|
|||
-mayaliasunique \
|
||||
-realcompare \
|
||||
-observertrans \
|
||||
-shiftnegative \
|
||||
-abstract \
|
||||
-statictrans \
|
||||
-castfcnptr
|
||||
|
|
2
gmqcc.h
2
gmqcc.h
|
@ -1163,7 +1163,7 @@ typedef struct {
|
|||
|
||||
extern opts_cmd_t opts;
|
||||
|
||||
#define OPTS_GENERIC(f,i) (!! (((f)[(i)/32]) & (1<< ((i)%32))))
|
||||
#define OPTS_GENERIC(f,i) (!! (((f)[(i)/32]) & (1<< (unsigned)((i)%32))))
|
||||
#define OPTS_FLAG(i) OPTS_GENERIC(opts.flags, (i))
|
||||
#define OPTS_WARN(i) OPTS_GENERIC(opts.warn, (i))
|
||||
#define OPTS_WERROR(i) OPTS_GENERIC(opts.werror, (i))
|
||||
|
|
4
parser.c
4
parser.c
|
@ -1038,9 +1038,9 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
case opid2('>','>'):
|
||||
if (CanConstFold(exprs[0], exprs[1]) && ! NotSameType(TYPE_FLOAT)) {
|
||||
if (op->id == opid2('<','<'))
|
||||
out = (ast_expression*)parser_const_float(parser, (double)((int)(ConstF(0)) << (int)(ConstF(1))));
|
||||
out = (ast_expression*)parser_const_float(parser, (double)((unsigned int)(ConstF(0)) << (unsigned int)(ConstF(1))));
|
||||
else
|
||||
out = (ast_expression*)parser_const_float(parser, (double)((int)(ConstF(0)) >> (int)(ConstF(1))));
|
||||
out = (ast_expression*)parser_const_float(parser, (double)((unsigned int)(ConstF(0)) >> (unsigned int)(ConstF(1))));
|
||||
break;
|
||||
}
|
||||
case opid3('<','<','='):
|
||||
|
|
Loading…
Reference in a new issue