__emit: Fix undefined behavior
Apparently shifting a 32-bit signed value by 31 bits is UB...
This commit is contained in:
parent
991eed9303
commit
5c4e0c27a7
@ -6314,7 +6314,7 @@ fetchtok:
|
||||
case tRATIONAL:
|
||||
if (!allow_nonint)
|
||||
goto invalid_token;
|
||||
p->value.ucell=(ucell)(negate ? (val|((cell)1 << (PAWN_CELL_SIZE-1))) : val);
|
||||
p->value.ucell=(negate ? ((ucell)val|((ucell)1 << (PAWN_CELL_SIZE-1))) : (ucell)val);
|
||||
break;
|
||||
case tSYMBOL:
|
||||
sym=findloc(str);
|
||||
|
@ -1405,7 +1405,7 @@ static int command(void)
|
||||
break;
|
||||
} else if (current_token==tRATIONAL) {
|
||||
/* change the first bit to make float negative value */
|
||||
outval(val|((cell)1 << (PAWN_CELL_SIZE-1)),FALSE);
|
||||
outval(val|(cell)((ucell)1 << (PAWN_CELL_SIZE-1)),FALSE);
|
||||
code_idx+=opargs(1);
|
||||
break;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user