Re: fast bit rotation

new topic     » goto parent     » topic index » view thread      » older message » newer message

Using a precomputed table is 2 of my examples.
One arrangement of 7x256 another of 256x7.

Except for the precomputed tables, any of my examples could
be modified for 32-bit integers and extended to work on sequences
to rotate all of the values within.  Making the assumption that
all values within the sequence are not floats.

        Lucius L. Hilley III

----- Original Message ----- 
From: "Pete Lomax" <petelomax at blueyonder.co.uk>
To: <EUforum at topica.com>
Sent: Wednesday, December 31, 2003 10:59 AM
Subject: Re: fast bit rotation


> 
> 
> Another thing you could try is to build tables of pre-computed shifts,
> eg:
> 
> sequence shl, shr
> shl=repeat(0,256)
> shr=repeat(0,256)
> for i = 0 to 255 do
> if i<=127 then
> shl[i+1]=i*2
> else
> shl[i+1]=and_bits(i,#7F)*2+1
> end if
> shr[shl[i+1]+1]=i
> end for
> 
> Use k=shl[k+1] when k is 0..255, to avoid zero index problems.
> 
> You can do your own test/timings, though I got 3.9 million/sec on a
> 233MHz PII with 48Mb ram, sorry Tommy, CNR blink)
> 
> Pete
> PS No warranty on the above code, btw.
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu