Author: Peter Fendrich
Date: 15:20:15 05/30/04
Go up one level in this thread
On May 30, 2004 at 18:09:49, Uri Blass wrote: >On May 30, 2004 at 17:51:13, Peter Fendrich wrote: > >>If zobrist is signed you will encounter problems when shifting it. >>/Peter > >I think that my zobrist is unsigned. > > >My function to generate "random" 64 bit numbers generate signed number but >return it as unsigned number > >I have >typedef unsigned __int64 BitBoard; >static BitBoard rand64() >{ > __int64 r = rand(); > r ^= (__int64)rand() << 15; > r ^= (__int64)rand() << 30; > r ^= (__int64)rand() << 45; > r ^= (__int64)rand() << 60; >return r; >} > >BitBoard zobrist[6][2][64]; > >zobrist[fil][i][j]=rand64(); > >The problem is that when I do > >r1=(unsigned)zobrist[fil][i][j]&4294967295; >r2=(unsigned)(zobrist[fil][i][j]>>32); >r=r1 | (BitBoard) r2<<32; > >I get r!=zobrist[fil][i][j] > >Uri What made me think you have a signed zobrist are the rx=(unsigned)zobrist[fil][i][j].... statements. There is no reason to cast to unsigned if it's already unsigned. The statement: r2=(unsigned)(zobrist[fil][i][j]>>32); looks very strange to me because with parentheses you force the "(unsigned)" cast to be made after the shift is done. It makes no sence to to me whether it's signed or not. /Peter
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.