Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Mirroring a 32bit bitboard

Author: martin fierz

Date: 18:48:43 04/09/02

Go up one level in this thread


On April 09, 2002 at 19:04:25, Eugene Nalimov wrote:

>Something like that is more or less portable and does not require any dirty
>tricks:
>
>extern unsigned char rgReverseByte[256];
>
>unsigned Reverse32 (unsigned uValue)
>{
>    return ((rgReverseByte[uValue & 0xFF]) << 24) +
>           ((rgReverseByte[(uValue >> 8) & 0xFF]) << 16) +
>           ((rgReverseByte[(uValue >> 16) & 0xFF]) << 8) +
>           rgReverseByte[uValue >> 24];
>}
>
>Eugene

is there any reason for not using this:
unsigned int revword[65536];

int revert(int32 n)
	// reverses a 32-bit integer
	{
	return(	revword[hiword(n)]+revword[loword(n)]<<16);
	}

hiword and loword are shift/mask macros like in your code above.
which is (a slightly improved) version of my code which alvaro is trying to
improve upon? i mean, is there some reason why you use a byte instead of word
table? and use bytes instead of ints in the table?

aloha
 martin


>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



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.