highfidelity/hifi — pull request #2389 by thagale (2014-03-19 21:31:40+00:00)
Title: Potential fix for #2386

This compiles and seems to work in my local environment, but I haven't written C++ in years and this is my first commit to hifi...someone probably ought to check my work. :)

FYI, I generated the table with this hacky bit of PHP:

---SNIP ---

function numberOfOnes($byte) {
return ($byte >> 7)
+ (($byte >> 6) & 1)
+ (($byte >> 5) & 1)
+ (($byte >> 4) & 1)
+ (($byte >> 3) & 1)
+ (($byte >> 2) & 1)
+ (($byte >> 1) & 1)
+ ($byte & 1);
}

echo "\nstatic const int nbits[256] = {\n";
for ($x=0; $x < 256; $x++){
echo numberOfOnes($x) . ",";
}
echo "\n};\n";