On 25 Oct 2010, at 11:10, Jonas Maebe wrote:
On 25 Oct 2010, at 10:43, Rugxulo wrote:
In all seriousness, I would doubt the FPC answer would ever be considered correct in this context (heh, 9 gazillion from "-2 shr 1"? highly unlikely). I'm sure they'll be glad for a test case / bug report.
Yes, that's definitely a compiler bug. Kylix also returns the same results as GPC.
Actually, it's rather strange: "shr" is a logical shift right (both in FPC and Borland Pascal, and I assume also in GPC) as opposed to an arithmetic shift right. So I guess that Kylix and GPC also perform a 64 bit logical shift right on the value, but then unlike FPC truncate the result back to 32 bits. Otherwise I'm not sure where the "-1" comes from when doing "(-2)shr 1".
Jonas