> Date: Fri, 25 Sep 2015 23:04:03 +0200 > From: Ingo Schwarze <schwa...@usta.de> > Cc: misc@openbsd.org > Content-Disposition: inline > X-XS4ALL-DNSBL-Checked: mxdrop113.xs4all.nl checked 199.185.137.3 against DNS > blacklists > X-CNFS-Analysis: v=2.1 cv=Z+kRZylA c=1 sm=0 tr=0 > a=VwSXPDCcsmtHzRxBP0Jd6w==:117 a=VwSXPDCcsmtHzRxBP0Jd6w==:17 > a=3tcz3bTJAAAA:8 a=_lmKfE_oAAAA:8 a=kj9zAlcOel0A:10 a=MKtGQD3n3ToA:10 > a=1oJP67jkp3AA:10 a=ZZnuYtJkoWoA:10 a=ff-B7xzCdYMA:10 > a=WsxIhy5ZiPrQYh7vP1UA:9 a=CjuIK1q_8ugA:10 > X-Virus-Scanned: by XS4ALL Virus Scanner > X-XS4ALL-Spam-Score: 0.0 () UNPARSEABLE_RELAY > X-XS4ALL-Spam: NO > Envelope-To: open...@xs4all.nl > > Mark Kettenis wrote on Fri, Sep 25, 2015 at 02:27:52PM -0600: > > > CVSROOT: /cvs > > Module name: src > > Changes by: kette...@cvs.openbsd.org 2015/09/25 14:27:52 > > > > Modified files: > > sys/dev/pci/drm: drm_linux.h > > > > Log message: > > Apparently 0 is not a power of 2 (despite <sys/param.h> claiming that it > > is). > > Fixes inteldrm(4) on the GM45 chipset. > > Heh. It also claims that INT_MIN is a power of 2, which isn't true either... > > Then again, INT_MIN is weird anyway, given that > INT_MIN == -INT_MIN && INT_MIN != 0. > > Or do you think > > (x > 0 && (((x) - 1) & (x)) == 0) > > would be even safer?
Well, the is_power_of_2() macro in drm_linux.h is now bug-compatible with Linux, which is what matters ;). And perhaps it is intentional that powerof2(0) is true. Even Linux has it that way. I'd say this is better left like it is now.