On Tue, 2014-01-07 at 21:43 +0200, Or Gerlitz wrote:
On Tue, Jan 7, 2014 at 8:08 PM, Tom Herbert [off-list ref] wrote:
quoted
Why ^ instead of != ?
The XOR approach is very popular in the GRO stack, e.g see the IPv4 chain
of inet_gro_receive() && tcp_gro_receive(), I guess this might relates
to more efficient assembly code for ^ vs. != and/or the fast/elegant
transitive nature of that operator
This trick is only needed/used when many compares are folded into a
single conditional :
if (a->f1 != b->f1 || a->f2 != b->f2)
->
if (((a->f1 ^ b->f1) | (a->f2 ^ b->f2)) != 0)
Please do not use XOR for a single compare.