On Fri, 17 May 2019 11:51:20 +0100 "J. Gareth Moreton" <[email protected]> wrote:
> One thing to be aware of is that the compiler will extend intermediate > expressions to the CPU size, so if the multiplication overflows into 32 > bits in h1 (which it does for the given values of a and b), it will > preserve those bits and will end up shifting them to the right instead > of zeroes. > > For h2, the overflowed bits are masked out with the "and ((s - 1) shl > (16 - n))" operation, which in this example is equal to $FFF0. > > I hope this answers your question. > > Gareth aka. Kit Thank you, your answer make it clear the nature of the problem, i.e. operation size extension. Anyway, if I understand correct, the masking as reported in the code does not operate over the 16 bit limit, so even h2 should be erroneus. -- Simplex sigillum veri _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
