dkh.bitop

  • Declaration

    bool poppar(uint v);
    bool poppar(ulong v);

    poppar(v) == popcnt(v) % 2

    Examples

    1. import std.random; foreach (i; 0..100) { uint v = uniform!"[]"(0U, uint.max); assert(poppar(v) == popcnt(v) % 2); } foreach (i; 0..100) { ulong v = uniform!"[]"(0UL, ulong.max); assert(poppar(v) == popcnt(v) % 2); }