On Sat, May 7, 2016 at 8:34 AM, Robert Haas <[email protected]> wrote:
> On Mon, May 2, 2016 at 8:25 PM, Andres Freund <[email protected]> wrote:
>> +static const uint8 number_of_ones_for_visible[256] = {
>> ...
>> +};
>> +static const uint8 number_of_ones_for_frozen[256] = {
>> ...
>> };
>>
>> Did somebody verify the new contents are correct?
>
> I admit that I didn't. It seemed like an unlikely place for a goof,
> but I guess we should verify.
Looks correct. The tables match the output of the attached script.
--
Thomas Munro
http://www.enterprisedb.com
def popcount(value):
return bin(value).count("1")
def make_popcount_table(mask):
for high_nibble in range(0, 16):
line = "\t"
for low_nibble in range(0, 16):
value = (high_nibble << 4) | low_nibble
line += str(popcount(value & mask))
if low_nibble != 15:
line += ", "
elif high_nibble != 15:
line += ","
print line
if __name__ == "__main__":
print "static const uint8 number_of_ones_for_visible[256] = {"
make_popcount_table(0b01010101) # for each bit pair, the lower bit
print "};"
print "static const uint8 number_of_ones_for_frozen[256] = {"
make_popcount_table(0b10101010) # for each bit pair, the higher bit
print "};"
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers