#include uint32_t nsamebit(uint64_t, uint64_t, uint64_t); uint32_t nsamebit(uint64_t a, uint64_t b, uint64_t c) { uint32_t n; uint64_t x = ~((a ^ b) | (a ^ c)); for (n = 0; x; x >>= 1) n += (uint32_t)(x & 1); return n; }