mirror of https://gitee.com/openkylin/qemu.git
target-arm: fix sdiv helper
(INT32_MIN / -1) triggers an overflow, and the result depends on the host architecture (INT32_MIN on arm, -1 on ppc, SIGFPE on x86). Use a test to output the correct value. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
This commit is contained in:
parent
7bbcb0afe7
commit
686eeb93d5
|
@ -402,6 +402,8 @@ int32_t HELPER(sdiv)(int32_t num, int32_t den)
|
|||
{
|
||||
if (den == 0)
|
||||
return 0;
|
||||
if (num == INT_MIN && den == -1)
|
||||
return INT_MIN;
|
||||
return num / den;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue