[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B71F2@saturn3.aculab.com>
Date: Tue, 23 Apr 2013 16:24:33 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Linus Torvalds" <torvalds@...ux-foundation.org>
Cc: "Ingo Molnar" <mingo@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
"Thomas Gleixner" <tglx@...utronix.de>,
"David Miller" <davem@...emloft.net>,
"Theodore Ts'o" <tytso@....edu>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
"Network Development" <netdev@...r.kernel.org>,
<linux-ext4@...r.kernel.org>
Subject: RE: Unsigned widening casts of binary "not" operations..
> > If the narrower type is signed it is probably even more confusing!
> > The high bits will be preserved unless you are masking off bit 31.
>
> Yes. However, that case doesn't trigger with the normal case of small
> values. So "~4" works fine with widening, in a way that "~4u" does
> not.
Thinks ... converting:
foo &= ~bar;
to:
foo = ~(~foo | bar);
would generally DTRT.
Whether the compiler has the relevant patterns to optimise
it is another question.
David
Powered by blists - more mailing lists