All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Philippe Troin <phil@fifi.org>
Cc: Lee Revell <rlrevell@joe-job.com>,
	Bernd Petrovitsch <bernd@firmix.at>,
	Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Grant Coady <lkml@dodo.com.au>,
	Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Puneet Vyas <vyas.puneet@gmail.com>
Subject: Re: xor as a lazy comparison
Date: Mon, 25 Jul 2005 15:24:03 -0400	[thread overview]
Message-ID: <1122319443.6019.69.camel@localhost.localdomain> (raw)
In-Reply-To: <87ackaitlj.fsf@ceramic.fifi.org>

On Mon, 2005-07-25 at 12:16 -0700, Philippe Troin wrote:
> Lee Revell <rlrevell@joe-job.com> writes:
> 
> > On Mon, 2005-07-25 at 13:55 -0400, Steven Rostedt wrote: 
> > > Doesn't matter. The cycles saved for old compilers is not rational to
> > > have obfuscated code.
> > 
> > Where do we draw the line with this?  Is x *= 2 preferable to x <<= 2 as
> > well?
> 
> Depends if you want to multiply by 2 or 4 :-)

I guess this proves my point :-)

But lets look at the signal.c code as well:

        if ((!info || ((unsigned long)info != 1 &&
                        (unsigned long)info != 2 && SI_FROMUSER(info)))
            && ((sig != SIGCONT) ||
                (current->signal->session != t->signal->session))
            && (current->euid ^ t->suid) && (current->euid ^ t->uid)
            && (current->uid ^ t->suid) && (current->uid ^ t->uid)
            && !capable(CAP_KILL))
                return error;

Why did they do the (current->signal->session != t->signal->session) and
not also do (current->signal->session ^ t->signal->session)?

Bit shifting for doubling (or quadrupling) may or may not be confusing,
(I don't mind that), but using xor for non-equal is IMO past that line.
Since, I usually use xor for bit masks. Looking at the above code,
especially since it is not always used, I would think that euid, uid,
and suid are all bitmasks.

-- Steve



  parent reply	other threads:[~2005-07-25 19:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=1122319443.6019.69.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=akpm@osdl.org \
    --cc=bernd@firmix.at \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@dodo.com.au \
    --cc=phil@fifi.org \
    --cc=rlrevell@joe-job.com \
    --cc=vyas.puneet@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.