Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Mirroring a 32bit bitboard

Author: Dann Corbit

Date: 15:22:10 04/09/02

Go up one level in this thread


On April 09, 2002 at 17:32:15, Alvaro Jose Povoa Cardoso wrote:

>Does anyone kow how to do a fast 32bit bitboard mirroring?
>bit 0  ->  bit 31
>bit 1  ->  bit 30
>bit 2  ->  bit 29
>...etc
>
>I would like to do it fast.
>
>Best regards,
>Alvaro Cardoso

Another simple technique is:

1. Swap 2 byte unsigned ints (unsavory union hack) {non-portable, allowed to
cause nasal demons to fly out of your nose but works most of the time anyway}
2. Swap unsigned chars within those ints (same)
3. Swap bits within the bytes by table lookup of 256 entries.





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.