public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Matt Sealey <matt@genesi-usa•com>
To: Scott Wood <scottwood@freescale•com>
Cc: linuxppc-dev@ozlabs•org, Kevin Diggs <kevdig@hypersurf•com>
Subject: Re: cntlzw
Date: Fri, 06 Jun 2008 10:53:13 +0100	[thread overview]
Message-ID: <48490909.4020901@genesi-usa.com> (raw)
In-Reply-To: <4845A55E.2030503@freescale.com>

It's in the Compiler Writer's Guide with explanation; section 5-10.

http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6

There are lots of clever examples in there, it's definitely recommended
reading (I should make a cheat sheet of chapter 5 though so I can pin it
to my wall)

-- 
Matt Sealey <matt@genesi-usa•com>
Genesi, Manager, Developer Relations

Scott Wood wrote:
> Kevin Diggs wrote:
>> Hi,
>>
>>     x86 has bsf and bsr. PPC has cntlzw which I think is equivalent to 
>> bsr. Anyone know of a sneaky algorithm to do bsf?
> 
> wordsize - 1 - cntlzw(x & ~(x - 1));
> 
> -Scott
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs•org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

      reply	other threads:[~2008-06-06  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 20:06 cntlzw Kevin Diggs
2008-06-03 20:11 ` cntlzw Scott Wood
2008-06-06  9:53   ` Matt Sealey [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=48490909.4020901@genesi-usa.com \
    --to=matt@genesi-usa$(echo .)com \
    --cc=kevdig@hypersurf$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=scottwood@freescale$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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