XOR and XNOR operations with 2 or 3 inputs

The hardware approach is how the Wiki article said some / many hardware XOR (and XNOR) devices are built by cascading a two-input gate into the first input of another two-input gate, and so on for as many inputs as required.

e.g.:

in1 *----\
>---|     \    *----\
in2 |      |---|     \    *----\
>---|     /    |      |---|     \
    *----/  +--|     /    |      |---> out
in3         |  *-----  +--|     /
>-----------+          |  *----/
                       |
in4                    |
>----------------------+

Your code seems to be an equivalent to this, so if that's what you're going for, I think you've got it. 8)