Author: Sander de Zoete
Date: 14:48:29 01/21/03
Go up one level in this thread
Dan,
Thanks for the code, I found the following algorithm on the internet to
reverse the board. My P3-laptop does not support SSE, so I have to walk right
over to my P4: Meanwhile, here is what I'm working on.
BITBOARD RevBoard(BITBOARD bb) // MMX
{
static const __int64 C55 = 0x5555555555555555;
static const __int64 C33 = 0x3333333333333333;
static const __int64 C0F = 0x0F0F0F0F0F0F0F0F;
asm {
// Load Bitboard into MMX
movq mm0, qword ptr bb
// 1. x = [(x shl 1) and C55] or [(x and C55) shr 1]
movq mm1, mm0
psllq mm0, 1
pand mm0, C55
pand mm1, C55
psrlq mm1, 1
por mm0, mm1
// 2. x = [(x shl 2) and C33] or [(x and C33) shr 2]
movq mm1, mm0
psllq mm0, 2
pand mm0, C33
pand mm1, C33
psrlq mm1, 2
por mm0, mm1
// 3. x = [(x shl 4) and C0F] or [(x and C0F) shr 4]
movq mm1, mm0
psllq mm0, 4
pand mm0, C0F
pand mm1, C0F
psrlq mm1, 4
por mm0, mm1
// 4. x = (x shlw 8) or (x shrw 8) 0123456789ABCDEF
movq mm1, mm0
psllq mm0, 8
pand mm0, C0F
pand mm1, C0F
psrlq mm1, 8
por mm0, mm1
// 5. x = x pshufw 00011011b (not supported on P3)
pshufw mm0, 00011011b
// Unload bitboard from MMX
movq mm1, mm0
psrlq mm1, 32
movd eax, mm0
movd edx, mm1
}
}
pshufw, is not supported on this PC.
Sander.
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.