mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philip Blundell <pb@nexus.co.uk>
To: David Woodhouse <Dave@imladris.demon.co.uk>
Cc: Meelis Roos <mroos@tartu.cyber.ee>, linux-kernel@vger.rutgers.edu
Subject: Re: faster strcpy()
Date: Fri, 24 Apr 1998 11:26:09 +0100	[thread overview]
Message-ID: <E0ySfgI-0006zV-00@spring.nexus.co.uk> (raw)
In-Reply-To: Your message of "Fri, 24 Apr 1998 11:14:34 +0200." <E0ySfV5-00058I-00@imladris.demon.co.uk>

>It's something like subtracting 0x01010101 from the dword and oring with 
>0x80808080 to detect the carry, but that's not quite it. Perhaps you do 

/* The following magic check was designed by A. Mycroft. It yields a     */
/* nonzero value if the argument w has a zero byte in it somewhere. The  */
/* messy constants have been unfolded a bit in this code so that they    */
/* get preloaded into registers before relevant loops.                   */

#ifdef _copywords
#  define ONES_WORD   0x01010101
#  define EIGHTS_WORD (ones_word << 7)
#  define nullbyte_prologue_() \
      int ones_word = ONES_WORD;
#  define word_has_nullbyte(w) (((w) - ones_word) & ~(w) & EIGHTS_WORD)
#endif

p.



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

       reply	other threads:[~1998-04-24 10:23 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 [this message]
1998-04-25 22:44   ` Alexander Kjeldaas
     [not found]     ` <19980426013108.48608@lucifer.guardian.no>
1998-04-26 15:17       ` Pavel Machek

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=E0ySfgI-0006zV-00@spring.nexus.co.uk \
    --to=pb@nexus.co.uk \
    --cc=Dave@imladris.demon.co.uk \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=mroos@tartu.cyber.ee \
    /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®