mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Coady <lkml@dodo.com.au>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: xor as a lazy comparison
Date: Mon, 25 Jul 2005 06:07:50 +1000	[thread overview]
Message-ID: <kis7e1d4khtde78oajl017900pmn9407u4@4ax.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0507241835360.18474@yvahk01.tjqt.qr>

On Sun, 24 Jul 2005 18:40:25 +0200 (MEST), Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
>
>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 ^ ?
To confuse you, coders with assembly or hardware background throw in 
equivalent bit operations to succinctly describe their visualisation 
of solution space...  Perhaps the writer _wanted_ you to pause and 
think?  Maybe the compiler produces better code?  Try it and see.

Grant.


  reply	other threads:[~2005-07-24 20:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-24 16:40 Jan Engelhardt
2005-07-24 20:07 ` Grant Coady [this message]
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
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=kis7e1d4khtde78oajl017900pmn9407u4@4ax.com \
    --to=lkml@dodo.com.au \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®