poppar(v) == popcnt(v) % 2
1 import std.random; 2 foreach (i; 0..100) { 3 uint v = uniform!"[]"(0U, uint.max); 4 assert(poppar(v) == popcnt(v) % 2); 5 } 6 foreach (i; 0..100) { 7 ulong v = uniform!"[]"(0UL, ulong.max); 8 assert(poppar(v) == popcnt(v) % 2); 9 }
See Implementation
poppar(v) == popcnt(v) % 2