diff mbox

[wide-int] Fix exact_log2 zext test

Message ID 87fvrfksw8.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Nov. 2, 2013, 10:19 a.m. UTC
...which I'd fluffed when doing the wi:: conversion.

Tested on powerpc64-linux-gnu and x86_64-linux-gnu.  It fixed a spurious
gcc.dg difference on alpha-linux-gnu.  Applied as obvious.

Thanks,
Richard

Comments

Kenneth Zadeck Nov. 2, 2013, 1:39 p.m. UTC | #1
On 11/02/2013 06:19 AM, Richard Sandiford wrote:
> ...which I'd fluffed when doing the wi:: conversion.
>
> Tested on powerpc64-linux-gnu and x86_64-linux-gnu.  It fixed a spurious
> gcc.dg difference on alpha-linux-gnu.  Applied as obvious.
>
> Thanks,
> Richard
>
>
> Index: gcc/wide-int.cc
> ===================================================================
> --- gcc/wide-int.cc	(revision 204311)
> +++ gcc/wide-int.cc	(working copy)
> @@ -2044,7 +2044,7 @@
>   
>     /* Get a zero-extended form of block CRUX.  */
>     unsigned HOST_WIDE_INT hwi = x.val[crux];
> -  if (crux * HOST_BITS_PER_WIDE_INT > x.precision)
> +  if ((crux + 1) * HOST_BITS_PER_WIDE_INT > x.precision)
>       hwi = zext_hwi (hwi, x.precision % HOST_BITS_PER_WIDE_INT);
>   
>     /* Now it's down to whether HWI is a power of 2.  */
ok by me.

kenny
diff mbox

Patch

Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc	(revision 204311)
+++ gcc/wide-int.cc	(working copy)
@@ -2044,7 +2044,7 @@ 
 
   /* Get a zero-extended form of block CRUX.  */
   unsigned HOST_WIDE_INT hwi = x.val[crux];
-  if (crux * HOST_BITS_PER_WIDE_INT > x.precision)
+  if ((crux + 1) * HOST_BITS_PER_WIDE_INT > x.precision)
     hwi = zext_hwi (hwi, x.precision % HOST_BITS_PER_WIDE_INT);
 
   /* Now it's down to whether HWI is a power of 2.  */