Re: [fpc-devel] Division nodes

2023-05-19 Thread J. Gareth Moreton via fpc-devel
That's useful to know - thanks Florian.  So it's possible to forego the -1 check if no downsizing occurs. I suppose it makes sense... if we go by the signed 64-bit equivalents, $8000 div $ = $8000, which when typecast to a LongInt does result in a

Re: [fpc-devel] Division nodes

2023-05-19 Thread J. Gareth Moreton via fpc-devel
So I need to ask... should the check for a divisor of -1 still be performed? The case of doing "min_int div -1", even with unsigned-to-signed typecasting, seems very contrived and the programmer should expect problems if "min_int" and "-1" appear as the operands.  Is there a specific example

Re: [fpc-devel] Division nodes

2023-05-19 Thread Florian Klämpfl via fpc-devel
Am 19.05.23 um 21:14 schrieb J. Gareth Moreton via fpc-devel: So I need to ask... should the check for a divisor of -1 still be performed? Yes. This is the result of "down sizing" a division. In case of longint(int64 div int64) can be converted only into longint(int64) div longint(int64) if