From d6c6c84f768c5dd449bae3251e688f59756202e1 Mon Sep 17 00:00:00 2001 From: sergei Date: Mon, 16 Jun 2014 17:05:01 +0000 Subject: [PATCH] * calc_divconst_magic_unsigned: explicitly limit the shift amount to number of bits of target platform. This happens implicitly only on x86, on other 32-bit targets shifting by more than 31 bits calculates as zero. git-svn-id: trunk@27983 - --- compiler/cgutils.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cgutils.pas b/compiler/cgutils.pas index 41ae0366d3..fb2fea8c77 100644 --- a/compiler/cgutils.pas +++ b/compiler/cgutils.pas @@ -388,7 +388,7 @@ uses magic_add:=false; {$push} {$warnings off } - mask:=aWord(not 0) shr (64-N); + mask:=aWord(not 0) shr ((64-N) and (sizeof(aWord)*8-1)); nc:=(mask-(-d) mod aInt(d)); {$pop} p:=N-1; { initialize p }