Re: an inconsistency in generated code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Marc!

This certainly works for my original problem. But my question is why gcc is kind of changing its mind as it generates the code for the functions I sent in my original post -- it just seems illogical.


-Pavel



----- Original Message -----
From: Marc Glisse <marc.glisse@xxxxxxxx>
To: Pavel Tolkachev <paultolk@xxxxxxxxx>
Cc: GCC Users List <gcc-help@xxxxxxxxxxx>
Sent: Tuesday, August 16, 2011 1:40 AM
Subject: Re: an inconsistency in generated code?

On Mon, 15 Aug 2011, Pavel Tolkachev wrote:

> I needed to write portable and
> fast C/C++ function to bit-negate the most significant byte of a 32-bit
> integer. Currently, my target is i386. First, I wrote this function:
>
> uint32_t
> BitNegMsb_1(uint32_t v)
> {
>   return (v & 0xFFFFFFu) | (~v &0xFF000000u);
> }

Did you try with a xor?
return v^0xFF000000u;

-- 
Marc Glisse




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux