Author: Sune Fischer
Date: 01:07:55 09/13/02
Go up one level in this thread
On September 12, 2002 at 21:19:08, Gerd Isenberg wrote:
>Hi all,
>
>My first MMX-Routine (MSC inline asm) that gains considerable performance!
Wow, that's great. How much faster do think it is?
Do I need a special header or flags to compile it, msvc doesn't know how?
I actually need two variations of it, one for rooks and one for bishops, can you
translate them to MMX (without too much effort of course)?
#define SHIFTDOWN(b) ((b)>>8)
#define SHIFTUP(b) ((b)<<8)
#define SHIFTRIGHT(b) ((((b)<<1)&0xFEFEFEFEFEFEFEFE))
#define SHIFTLEFT(b) ((((b)>>1)&0x7F7F7F7F7F7F7F7F))
#define SHIFTUPLEFT(b) ((((b)<<7)&0x7F7F7F7F7F7F7F7F))
#define SHIFTUPRIGHT(b) ((((b)<<9)&0xFEFEFEFEFEFEFEFE))
#define SHIFTDOWNLEFT(b) ((((b)>>9)&0x7F7F7F7F7F7F7F7F))
#define SHIFTDOWNRIGHT(b) ((((b)>>7)&0xFEFEFEFEFEFEFEFE))
//===================================================================
int IsLineConnected(BITBOARD path,BITBOARD sq1,BITBOARD sq2) {
int n=0;
if (!(sq1&=path) || !(sq2&=path))
return 0;
register BITBOARD old_sq1;
while(1) {
if (sq1&sq2)
return n;
n++;
old_sq1=sq1;
sq1|=SHIFTRIGHT(sq1)|SHIFTLEFT(sq1);
sq1&=path;
sq1|=SHIFTDOWN(sq1)|SHIFTUP(sq1);
sq1&=path;
if (sq1==old_sq1)
return 0;
}
}
//===================================================================
int IsDiagonalConnected(BITBOARD path,BITBOARD sq1,BITBOARD sq2) {
int n=0;
if (!(sq1&=path) || !(sq2&=path))
return 0;
register BITBOARD old_sq1;
while(1) {
if (sq1&sq2)
return n;
n++;
old_sq1=sq1;
sq1|=SHIFTUPRIGHT(sq1)|SHIFTUPLEFT(sq1);
sq1&=path;
sq1|=SHIFTDOWNRIGHT(sq1)|SHIFTDOWNLEFT(sq1);
sq1&=path;
if (sq1==old_sq1)
return 0;
}
}
//===================================================================
Cheers,
-S.
This page took 0.01 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.