Hamming weight/population count in T-SQL

前端 未结 4 897
栀梦
栀梦 2020-12-12 01:41

I\'m looking for a fast way to calculate the hamming weight/population count/\"the number of 1 bits\" of a BINARY(1024) field. MySQL has a BIT_COUNT functio

4条回答
  •  天涯浪人
    2020-12-12 02:28

    I couldn't find a good way to do it. In the end I calculated the hamming weight in Java and periodically update the bit counts in the database.

提交回复
热议问题