STINNER Victor added the comment: > I would think that in real-world code, this branch will almost never be taken. The common case will pay a price (albiet a small one) for almost zero benefit.
I think that x << 0 is common even if it's not written like that (it's more for i in range(8): ... x << i). The benefit is to reduce the memory footprint. Can you sow the overhead of the branch in a microbenchmark? The test is only done once, it's out of a loop. *If* it's possible to notice an overhead, we can maybe use GCC macro unlikely(). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21422> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com