Computer Chess Club Archives


Search

Terms

Messages

Subject: My macros

Author: José Carlos

Date: 12:45:15 10/28/01

Go up one level in this thread


  I used an idea borrowed from Heiner's post some time ago. First, I implemented
it as #defines

#define SqFindFirst(sq,pi)	((sq)[pi]&0x3F)
#define SqFindSecond(sq,pi)	(((sq)[pi]>>6)&0x3F)
#define SqFindThird(sq,pi)	(((sq)[pi]>>12)&0x3F)
#define SqFindOne(sq,pi)	SqFindFirst(sq,pi)
#define SqFindKing(sq)		SqFindOne(sq,x_pieceKing)

  Later, I tried as functions, to be able to place breakpoints and check the
numbers:

square SqFindFirst(square *sq,piece pi)
{
	return sq[pi]&0x3F;
}
square SqFindSecond(square *sq,piece pi)
{
	return (sq[pi]>>6)&0x3F;
}
square SqFindThird(square *sq,piece pi)
{
	return (sq[pi]>>12)&0x3F;
}
square SqFindOne(square *sq,piece pi)
{
	return sq[pi]&0x3F;
}
square SqFindKing(square *sq)
{
	return sq[x_pieceKing]&0x3F;
}

  Any clue?

  José C.



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.