Author: Robert Hyatt
Date: 08:49:33 02/17/04
Go up one level in this thread
On February 17, 2004 at 10:48:35, Sune Fischer wrote: >On February 16, 2004 at 22:41:00, Robert Hyatt wrote: > >>This will make bitmaps insanely difficult to visualize. Remember that bit 0 is >>the LSB (or rightmost bit). That means your chess board is going to look like >>this when you display a bitboard as a hex number: >> >> >> >> h1 g1 f1 e1 d1 c1 b1 a1 >> >>Because the rightmost 8 bits would be displayed in that order. > >Correct. > >> That could drive >>someone to drink drain cleaner. I might be more tempted to make bit 0 either >>square h8, or h1 instead, so that things are not impossible to debug... > >Why on earth would you want to do something horrible like that? > When I display a 64 bit word, it pops out in hex. I want some simple way to translate that 64 bit image into what it represents about each square, so that I can do it mentally. Currently take the 64 bit word in groups of 8 bits. leftmost 8 bits is rank 1, next 8 bits is rank 2, all easy to visualize. I want to renumber the bits, but also make the 64 bit value something I can look at and then visualize without having to "flip" the board as might happen if I just change the square numbers and leave the bit/square correspondence alone. >>It would work as a1 of course, but it would take some thinking when working with >>the hex masks... > >The idea is that you get the first square to be the first bit and the last >square to be the last bit. > >This way you have the easy transformation: square_mask = 1<<square. > >>My main goal is to just invert my numbering scheme, so that bit 0 becomes bit >>63, and so forth, to get rid of the subtract everywhere... Not to mention >>needing an extra register regularly... > >What subtraction, what register? > >-S. I have to compute square = 63 - bsf(board) _that_ subtraction. And that needs a register. IE optimal (on opteron): bsfq %rax, %rbx ; result in %rbx done. result = %rbx Currently (on opteron): movq $63, %rbx bsfq %rax, %rcx subq %rcx, %rbx ; result 63-bsf in %rbx That transformation is done everywhere I currently use FirstOne()/LastOne(). Because I numbered the bits to avoid that on the Cray.
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.