2 Replies Latest reply on Feb 23, 2015 8:34 AM by binghy

    1 bits count in a variable

    binghy

      Hi everybody,

      I was wondering if there was an integer function to count the number of 1 bits contained in a variable.

      I saw the "clz" function allows to count the number of "leading 0 bits". If it was set as a function to count the number of "all the 0 bits", then I could obtain the number of 1 bits just by subtraction.

      No other similar funtion, nor in the OpenCL specs nor in the Blas library.

      Any suggestions?

       

      Thanks in advance

       

      Marco