From cbffb4f8d60a8516b23aae1bdf07197787ddce2c Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 5 Dec 2013 08:52:04 +0100 Subject: Added comment --- set_bitsets.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'set_bitsets.c') diff --git a/set_bitsets.c b/set_bitsets.c index f59e61e..4ac8462 100644 --- a/set_bitsets.c +++ b/set_bitsets.c @@ -24,13 +24,13 @@ int nb_one(unsigned long long x) { //the hamming weight of x assert(SCOD==64); //1 - x = (x & 0x5555555555555555) + ((x >> 1) & 0x5555555555555555); + x = (x & 0x5555555555555555) + ((x >> 1) & 0x5555555555555555); // mask : 0101010101... //2 - x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333); + x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333); // mask : 001100110011... //4 - x = (x & 0x0F0F0F0F0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F0F0F0F0F); + x = (x & 0x0F0F0F0F0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F0F0F0F0F); // mask : 000011110000.... //8 - x = (x & 0x00FF00FF00FF00FF) + ((x >> 8) & 0x00FF00FF00FF00FF); + x = (x & 0x00FF00FF00FF00FF) + ((x >> 8) & 0x00FF00FF00FF00FF); // etc. //16 x = (x & 0x0000FFFF0000FFFF) + ((x >> 16) & 0x0000FFFF0000FFFF); //32 -- cgit v1.2.3