Author: Keith Evans
Date: 11:55:49 05/28/01
Go up one level in this thread
On May 28, 2001 at 04:50:24, Dan Newman wrote:
>On May 28, 2001 at 01:40:52, Cheok Yan Cheng wrote:
>
>>For a game that used 8x8 board like chess, we can use the bit board
>>representation by using a 64 bit sized variable. However, for the game that used
>>board sized 9x10 like chinese chess, is it possible to use bit board
>>representation that need 90 bit sized variable (where can i get a variable sized
>>90 bits ??)
>>
>>thanks
>
>You could do something like this in C++ for a 32-bit machine:
<snip>
I saw someone do something like this in gcc once:
union bitmap {
unsigned long long ll[2];
};
typedef union bitmap Bitmap;
inline Bitmap or(Bitmap a, Bitmap b)
{
Bitmap ret;
ret.ll[0]=a.ll[0] | b.ll[0];
ret.ll[1]=a.ll[1] | b.ll[1];
return ret;
}
inline Bitmap and(Bitmap a, Bitmap b)
{
Bitmap ret;
ret.ll[0]=a.ll[0] & b.ll[0];
ret.ll[1]=a.ll[1] & b.ll[1];
return ret;
}
<etcetera>
You would probably want to change it so that it only computes 96-bits on a
32-bit processor. (Note: The union is there to allow us to return an array
outright in a C function.)
I would be interested in any feedback positive or negative. I'm a hardware
engineer who is used to being able to declare _arbitrarily_ sized registers in
Verilog.
Regards,
Keith
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.