> Except it would have to be util_is_power_of_two_or_zero because > util_is_power_of_two(0xffffffff + 1) is false. :)
Corner cases, corner cases! > Is there actually a 2/2 for this? We usually wouldn't land something > like this without a caller. The 1/2 on there was accidentally, sorry. The use is in https://lists.freedesktop.org/archives/mesa-dev/2019-June/220201.html, but I figure you didn't need to get neck deep into Mali :) It's just for an assert(), so I can get rid of it if this little patch is too much to bikeshed ;) Just thought I'd try. > This will return true for v == 0. Is that the desired behavior? I > mean, that is 2**0 - 1, but it is not "all ones in binary." I think the > result may surprise people wanting to use this to detect a mask. This > is also how we ended up with util_is_power_of_two_nonzero and > util_is_power_of_two_or_zero. Hm. I'm not sure *is* the desired behaviour. In my case, (v == 0) is special-cased anyway (see linked patch). Maybe not landing this is easier to just avoid the can of worms.
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev