On 10/08/2010 10:51 PM, Mark Kettenis wrote: >> Date: Fri, 08 Oct 2010 21:36:02 +0200 >> From: Takashi Iwai <[email protected]> >> >> At Fri, 8 Oct 2010 20:48:10 +0200 (CEST), >> Mark Kettenis wrote: >>> >>>> From: Takashi Iwai <[email protected]> >>>> Date: Fri, 8 Oct 2010 19:22:29 +0200 >>> >>> Sorry, but it isn't obvious to me what issue this fixes. >> >> In C, "1" is an integer, not an unsigned long. >> Thus (1 << 33) doesn't give you the 33th bit shift, but it's undefined. > > But if you'd actually use 33 (or event 32) as an offset, things > wouldn't work on a 32-bit platform would they?
I believe this is what the patch is supposed to fix. > Anyway, > >> If any, this must be (1UL << 32). > > This is the idiom that is much more common. I probably wouldn't have > questioned things if you'd written it like that. I recommend you to > stick to this version. For a counter-example, see the definition of test_bit() in the Linux kernel. >> Also, it'd be better if such a test macro returns 1 instead of a >> random non-zero value. So does my patch. > > In C this doesn't matter. It is still useful to know if a logic expression evaluates to (0, 1) or (0, nonzero). Henrik _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
