From: Scott Wood Date: Wed, 9 Sep 2015 13:59:17 -0500 Subject: [U-Boot] [PATCH v5] bitops: introduce BIT() definition In-Reply-To: <55F07FE3.1060805@linaro.org> References: <1440176519-30102-2-git-send-email-hs@denx.de> <1441626234-16364-1-git-send-email-andreas.devel@googlemail.com> <55EF2261.7090502@globallogic.com> <1441815745.29081.4.camel@freescale.com> <55F07FE3.1060805@linaro.org> Message-ID: <1441825157.29081.28.camel@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, 2015-09-09 at 21:52 +0300, Ivan Khoronzhuk wrote: > On 09.09.15 19:22, Scott Wood wrote: > > On Tue, 2015-09-08 at 21:01 +0300, ivan.khoronzhuk wrote: > > > Hi, Andreas > > > > > > On 07.09.15 14:43, Andreas Bie?mann wrote: > > > > From: Heiko Schocher > > > > > > > > introduce BIT() definition, used in at91_udc gadget > > > > driver. > > > > > > > > Signed-off-by: Heiko Schocher > > > > [remove all other occurrences of BIT(x) definition] > > > > Signed-off-by: Andreas Bie?mann > > > > --- > > > > Full buildman is running > > > > > > > > > > .... > > > > > > > > > > > +#define BIT(nr) (1UL << (nr)) > > > > > > Why UL? Why not simply 1 << (nr)? > > > > That would give the wrong result for nr == 31 if used as a 64-bit number, > > and > Did you mean with 64-bit signed number? No. "u64 x = 1 << 31" will put 0xffffffff80000000 in x, because (unlike 0x80000000 as a constant) "1 << 31" is signed. -Scott