From: John Hubbard <john.hubbard@gmail.com>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Soumyadip Das Mahapatra <kernelhacker@visualserver.org>,
linux-kernel@vger.kernel.org, akinobu.mita@gmail.com
Subject: Re: [PATCH 1/2] bitreversal program
Date: Mon, 19 May 2008 23:53:29 -0700 [thread overview]
Message-ID: <48327569.9070306@gmail.com> (raw)
In-Reply-To: <1211229736.5915.86.camel@brick>
Harvey Harrison wrote:
>> +static inline u32 gen_bit_rev(u32 x, u32 k)
>> {
>> - return byte_rev_table[byte];
>> + if(k & 1)
>> + x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1;
>> + if(k & 2)
>> + x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2;
>> + if(k & 4)
>> + x = (x & 0x0f0f0f0f) << 4 | (x & 0xf0f0f0f0) >> 4;
>> + if(k & 8)
>> + x = (x & 0x00ff00ff) << 8 | (x & 0xff00ff00) >> 8;
>> + if(k & 16)
>> + x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16;
>> +
>> + return x;
>> }
>
> Why is this better than a single 256 byte table?
>
> Harvey
>
One reason it could be better, at least in some situations, is that the
above is more likely to execute directly from the CPU's instruction
cache. The table lookup appears more efficient at first, until you
consider the memory caching hierarchy.
--John Hubbard
next prev parent reply other threads:[~2008-05-20 6:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 17:04 [PATCH 1/2] bitreversal program Soumyadip Das Mahapatra
2008-05-19 20:42 ` Harvey Harrison
2008-05-20 6:53 ` John Hubbard [this message]
2008-05-20 11:01 ` Soumyadip Das Mahapatra
2008-05-20 12:13 ` Akinobu Mita
2008-05-20 15:25 ` Soumyadip Das Mahapatra
2008-05-20 15:47 ` Benoit Boissinot
2008-05-20 15:57 ` Soumyadip Das Mahapatra
2008-05-20 16:39 ` Benoit Boissinot
2008-05-21 8:54 ` Soumyadip Das Mahapatra
2008-05-21 9:11 ` Benoit Boissinot
2008-05-21 11:11 ` Rene Herman
2008-05-21 16:52 ` Tilman Schmidt
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=48327569.9070306@gmail.com \
--to=john.hubbard@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=harvey.harrison@gmail.com \
--cc=kernelhacker@visualserver.org \
--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 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.