Author: Bernd Nürnberger
Date: 05:32:40 05/06/04
Go up one level in this thread
On May 06, 2004 at 07:58:12, Renze Steenhuisen wrote: >On May 06, 2004 at 07:07:57, Bernd Nürnberger wrote: > >>Hello, >> >>I have a really strange bug in my move generator, but in the meantime, >>after thourough debugging, I am more and more convinced, that it is not >>a bug in my programming but a bug in Java itself or in the OS/Hardware >>(but I am still hoping, I made a mistake somewhere ...). >> >>I have a iBook 300, Mac OS 9.x, and the latest Java for Mac OS 9.x (I think >>its MRJ SDK 2.2.4 or so). >> >>HERE COMES THE PROBLEM: >> >>Some 64 bit long values behave really strange: the upper part (the 32 MSBs) >>are trashed from time to time (lower 32 bits are OK, upper 32 bits seem >>more or less random). I looked through the code again and again, so that >>all literals have a "L" appended, and all literals seems ok now. >> >>Could it be, that some operators in Java on long values are not properly >>implemented and make errors on certain circumstances? Maybe a set upper >>bit (64th bit, sign bit) causes problems in some cases? >> >>I would be really glad to hear your thoughts are even solutions to this >>kind of problem. >> >>Many many thanks in advance for your answers! >> >>Best wishes, >> >>Bernd > > >Hi Bernd, > >could you give me some code to work with that causes the problem already? > >Cheers! > > Renze An example: The variables are declared int/long as appropriate; it's straight forward implementation as in many other bitboard based programs; hope just a snippet helps, because the whole relevant code maybe would be some thousand lines %-/ --- snip --- ... blackLegalMoves = board.whitePieces; // captures ... // k -- black king ///////////////////// // o normal moves and captures from = board.blackKing; // (*) mvboard = KING_MOVES[from] & blackLegalMoves; halfply = from | Move.BPC_KING; while (mvboard != 0L) { to = Bitboard.last(mvboard); mvboard &= Bitboard.CLEAR_MASK[to]; moves[mvidx++] = halfply | to << Move.TO | piece[to] << Move.CAPTY; } --- snap --- if I insert System.out.println(blackLegalMoves); at point (*) and similiar points in the code, the error is not present -- even more strange!?! what can here go wrong with longs? code for other piece types is similiar... Greetings, Bernd
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.