mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@elf.ucw.cz>
To: Alexander Kjeldaas <astor@guardian.no>
Cc: Philip Blundell <pb@nexus.co.uk>,
	David Woodhouse <Dave@imladris.demon.co.uk>,
	Meelis Roos <mroos@tartu.cyber.ee>,
	linux-kernel@vger.rutgers.edu
Subject: Re: faster strcpy()
Date: Sun, 26 Apr 1998 17:17:46 +0200	[thread overview]
Message-ID: <19980426171746.22129@Elf.mj.gts.cz> (raw)
In-Reply-To: <19980426013108.48608@lucifer.guardian.no>; from Alexander Kjeldaas on Sun, Apr 26, 1998 at 01:31:08AM +0200

Hi!

> > I'm not sure why Mycroft used '& ~(w)' in the above. Unless something
> > obvious escapes me, you can optimize the above down to 3
> > instructions. Both codepaths have a dependency chain of 3
> > instructions.
> > 
> > #define word_has_nullbyte(w) ((((w) - 0x01010101) ^ (w)) & 0x80808080)
> > 
> 
> Hmm.. two things obviously escaped me:
> 
> 1) The above fails horribly and detects 0x80 as a null.

It does not matter too much: you usually want 

word_has_probably_nullbyte(), since you usually want to know where the
nullbyte is and copy rest byte-by-byte.

								Pavel
-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

      parent reply	other threads:[~1998-04-26 17:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E0ySfV5-00058I-00@imladris.demon.co.uk>
1998-04-24 10:26 ` Philip Blundell
1998-04-25 22:44   ` Alexander Kjeldaas
     [not found]     ` <19980426013108.48608@lucifer.guardian.no>
1998-04-26 15:17       ` Pavel Machek [this message]

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=19980426171746.22129@Elf.mj.gts.cz \
    --to=pavel@elf.ucw.cz \
    --cc=Dave@imladris.demon.co.uk \
    --cc=astor@guardian.no \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=mroos@tartu.cyber.ee \
    --cc=pb@nexus.co.uk \
    /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®