Author: Gerd Isenberg
Date: 13:51:52 08/08/03
Go up one level in this thread
On August 08, 2003 at 16:30:22, Dieter Buerssner wrote:
>On August 08, 2003 at 16:15:26, Gerd Isenberg wrote:
>
>>Btw. if your row function is unsigned, it may cheaper to ask:
>>
>> if( (row(u)-1) < (7-1) )
>
>Hmm, shouldn't it be
> if( ((unsigned)row(u)-2) < (7-2) )
Hi Dieter,
is the unsigned cast necessary if row(int) is unsigned?
Ahh i see, macros instead of inlines ;-)
The original statement was for row 0..7 i guess
if( row(u) != 0 && row(u) != 7 ) {
or
if( row(u) > 0 && row(u) < 7 ) {
if i subtract 1, 0 becomes UINT_MAX and 7 becomes 6.
So below 6 or 7-1 seems correct to me.
>
>Or even better
> if ((unsigned)u-16 < 5*16)
>
But of course, you even need no row(u) for this promote square condition.
>So, that even the not too clever optimizer can see it?
Yes, and it becomes more readable ;-)
But i prefere inliner:
isPromoteSquare(sq) and eventually a polymorph
isPromoteSquare(sq, color)
or eventually, with a square class:
sq->isPromoteSquare();
sq->isPromoteSquare(color);
Regards,
Gerd
>
>Regards,
>Dieter
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.