Port-m68k archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Help with integer division overflow issue



> On Jan 12, 2024, at 3:20 AM, Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost> wrote:
> 
> # cc -o test-ccr test-ccr.c
> # ./test-ccr
> val = -2147483648 (0x80000000)
> ccr = 0x80000008
> # 

Wait, WAAAT?

So, not only is the V flag not set, but N is set (yah, I guess the result is negative, but it should have overflowed!) and some random upper bit in the “int ccr;” variable is set???

Help me to understand!

(At least the 68020 and 68030 behave the same way, I guess.)

-- thorpej



Home | Main Index | Thread Index | Old Index