1. 67

  2. 14

    In lighthearted protest of the clickbait title: popcount: hamming weight of the argument, i.e. number of bits set.

    This doesn’t seem very useful, right?

    Me, in crypto: uh what this sounds amazing.

    discusses its uses inside and outside cryptography

    There it is :)

    1. 6

      I originally came up with the clickbait title because a very early version of the !!Con CFP encouraged Upworthy-style submissions, and I stand by it. For every “this isn’t obscure at all!” there have been several “oh, I didn’t know that!” reactions.

    2. 6

      Also still useful for comparing compressed document vectors obtained through random projection hashing.

      However popcnt can be beaten for larger bitsets: http://0x80.pl/articles/sse-popcount.html

      1. 1

        Worth mentioning that go’s wrapper for this (math/bits) has support for replacing the function call with an inlined instruction-based version in the latest version.