public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* xor as a lazy comparison
@ 2005-07-24 16:40 Jan Engelhardt
  2005-07-24 20:07 ` Grant Coady
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Engelhardt @ 2005-07-24 16:40 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi list,


I have seen this in kernel/signal.c:check_kill_permission()

            && (current->euid ^ t->suid) && (current->euid ^ t->uid)

If current->euid and t->suid are the same, the xor returns 0, so these 
statements are effectively the same as a !=

	current->euid != t->suid ...

Why ^ ?


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: xor as a lazy comparison
@ 2005-07-27 18:24 Clayton Weaver
  2005-07-27 19:58 ` linux-os (Dick Johnson)
  0 siblings, 1 reply; 20+ messages in thread
From: Clayton Weaver @ 2005-07-27 18:24 UTC (permalink / raw)
  To: linux-kernel

Is not xor (^) typically compiled to a
one cycle instruction regardless of
requested optimization level? (May not
always have been the case on every
target architecture for != equality
tests.)
Clayton Weaver
cgweav at fastmail dot fm

PS:
Anyone know where I can get
a waterproof, battery powered gps that will fit inside the handle of a Fenwick?


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-07-28  0:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-24 16:40 xor as a lazy comparison Jan Engelhardt
2005-07-24 20:07 ` Grant Coady
2005-07-24 21:43   ` Jan Engelhardt
2005-07-24 22:15     ` Puneet Vyas
2005-07-25  8:57       ` Bernd Petrovitsch
2005-07-25 17:55         ` Steven Rostedt
2005-07-25 19:10           ` Lee Revell
2005-07-25 19:16             ` Philippe Troin
2005-07-25 19:18               ` Lee Revell
2005-07-26  6:07                 ` Jan Engelhardt
2005-07-26  8:30                   ` Bernd Petrovitsch
2005-07-25 19:24               ` Steven Rostedt
2005-07-25 19:27               ` Lee Revell
2005-07-25 19:23             ` Paulo Marques
2005-07-25 19:25               ` Lee Revell
2005-07-25 20:24             ` Bill Davidsen
2005-07-25 18:00         ` [PATCH] make signal.c more readable (was: Re: xor as a lazy comparison) Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2005-07-27 18:24 xor as a lazy comparison Clayton Weaver
2005-07-27 19:58 ` linux-os (Dick Johnson)
2005-07-28  0:04   ` Grant Coady

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox