mirror of
https://github.com/frida/tinycc
synced 2025-03-04 06:51:25 +03:00
fixed sign extension in some type conversions (Dave Dodge)
This commit is contained in:
parent
65b974e396
commit
fb2c34f8cd
4
tcc.c
4
tcc.c
@ -5764,6 +5764,10 @@ void force_charshort_cast(int t)
|
||||
bits = 32 - bits;
|
||||
vpushi(bits);
|
||||
gen_op(TOK_SHL);
|
||||
/* result must be signed or the SAR is converted to an SHL
|
||||
This was not the case when "t" was a signed short
|
||||
and the last value on the stack was an unsigned int */
|
||||
vtop->type.t &= ~VT_UNSIGNED;
|
||||
vpushi(bits);
|
||||
gen_op(TOK_SAR);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user