Author: Dave Gomboc
Date: 05:57:02 06/14/98
Go up one level in this thread
On June 14, 1998 at 06:43:51, Vincent Diepeveen wrote: > >On June 13, 1998 at 23:17:37, Dave Gomboc wrote: >> >>Let's say that A is the bitboard representing where the rook can move. >>B could be one of many things: the bitboard representing squares the >>opponent attacks at least as many times as you do, the bitboard >>representing squares the opponent attacks with a piece of lesser (or >>equal) value than the rook, the bitboard representing whatever your >>imagination comes up with... but in every case, computing A and not B >>should give you what you want in one clock cycle. >> >>Of course B isn't that easy to generate, depending on what you choose >>for it, but it's not like bitboards make this sort of computation >>impossible or extremely expensive either. > >Suppose you have both A and B, then how do you compute it >in O(1)? > >Not possible with the current array sizes. I tried replying to this once earlier and accidentally submitted my post with a space bar push when the focus somehow reached the submit button, how annoying. Anyway... I'm not sure why I said "in one clock cycle" above, clearly there are two operations that cannot overlap completely. I don't see how computing the result in O(1) time is going to be a problem, though. 64-bit architecture: Reg2 = B Reg1 = A Reg2 = -Reg2 Reg1 ||= Reg2 The result bitboard is in register 1. 32-bit architecture: Reg2 = B.low Reg1 = A.low Reg2 = -Reg2 Reg1 ||= Reg2 Reg3 = B.high Reg2 = A.high Reg3 = -Reg3 Reg2 ||= Reg3 The result bitboard is in registers 1 (low 32 bits) and 2 (high 32 bits). (||= means "assign the current value, 'or'ed by ..." for any non-programmers out there.) Anyway, there are a constant number of instructions, you might be able to save a few if stuff is already in registers, but that's irrelevant. The coefficient is higher for the 32-bit version than the 64-bit version, but both of the assembly snippets execute in O(1), so to speak. Dave Gomboc
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.