C: XNOR / Exclusive-Nor gate?

user359531 picture user359531 · Jun 6, 2010 · Viewed 11.6k times · Source

I am trying to find the most effective way of writing a XNOR gate in C.

if(VAL1 XNOR VAL2)
{
    BLOCK;
}

Any suggestions?

Thanks.

Answer

Tomas Markauskas picture Tomas Markauskas · Jun 6, 2010

With two operands this is quite simple:

if (val1 == val2)
{
    block;
}