On Mon, 30 Mar 2020 at 11:49, Zhiyi Zhang zzhang@codeweavers.com wrote:
/* http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2 */
if (width && !(width & (width - 1)) && height && !(height & (height - 1)))
URLs are best avoided, they're only rarely stable. In the general case, for an algorithm, mention its name if any, its authors, and the publication/standard. In the rare case that that's not an option, there's archive.org. In this particular case though, I think this kind of check is (or should be) common knowledge; we have that kind of power-of-two check in plenty of places (e.g. wined3d_texture_init(), wined3d_texture_update_desc()), and in its related version of an alignment check in even more.