Author: Robert Hyatt
Date: 14:48:50 07/18/02
Go up one level in this thread
On July 18, 2002 at 16:31:42, Steffen Jakob wrote:
>On July 18, 2002 at 15:16:11, Robert Hyatt wrote:
>
>>On July 18, 2002 at 13:39:01, Steffen Jakob wrote:
>>
>>>On July 18, 2002 at 13:23:23, Robert Hyatt wrote:
>>>
>>>>On July 18, 2002 at 12:21:26, Steffen Jakob wrote:
>>>>
>>>>>Hi Bob!
>>>>>
>>>>>On July 18, 2002 at 12:16:55, Robert Hyatt wrote:
>>>>>
>>>>>>
>>>>>>Extensions was a debugging tool. IE I used to have a parallel array with
>>>>>>the PV in one element and the extensions for that ply in another. Then when
>>>>>>I dumped the PV I could see which plies had extensions applied. I took that
>>>>>>out a long time back to save the time of backing up the stuff when I really
>>>>>>didn't care except on rare occasions during debugging.
>>>>>>
>>>>>>The rest are simply carry-overs. To me a&7 is clearer than a&CONST where I
>>>>>>might not remember which bits are on in CONST...
>>>>>
>>>>>I didn't think of making 7 const but something like this (from hossa-3.0 (aka
>>>>>Jockel@ICC) source):
>>>>>
>>>>>template <typename T> inline File getFile(const T &s) {
>>>>> return static_cast<File>(static_cast<unsigned int>(s) & 7);
>>>>>}
>>>>>template <typename T> inline Rank getRank(const T &s) {
>>>>> return static_cast<Rank>(static_cast<unsigned int>(s) >> 3);
>>>>>}
>>>>>
>>>>>or in C-world code
>>>>>#define getFile(s) ((s)&7)
>>>>>#define getRank(s) ((s)>>3)
>>>>>
>>>>>Greetings,
>>>>>Steffen.
>>>>
>>>>
>>>>I already do this. I have "Rank()" and "File()" macros that I use most
>>>>everywhere already. Ditto for "From()", "To()", "Piece()", "Captured()" to
>>>>extract that field from the 21 bit compressed move format I use internally.
>>>
>>><nitpicking>
>>>crafty> egrep '&7\)|>>3\)' *.[ch] | grep -v '#define' | wc --lines
>>> 23
>>></nitpicking>
>>>
>>>Best wishes,
>>>Steffen.
>>
>>
>>your egrep is NFG. If you look, many of those are in init.c and in the
>>chess.h file where the File() is actually defined using that pattern. :)
>
>What's so special about init.c? I use my encapsulating code in class
>constructors as well ;-) BTW: the definitions of the macros are excluded by the
>2nd grep call with the -v option above.
>
>Greetings,
>Steffen.
Note your grep -v only works on #defines where it fits on one line. Hint: mine
often go to 2=3=4 lines which breaks that. Also, not all &7 has anything to do
with the file number. For example my transposition age field is 3 bits and I
use the &7 to truncate the age... as in age = (age+1) & 7; which tricks your
grep into thinking that I used that file mask again. :)
In any case, I have fixed all that are legitimate rank and file accesses to
use the correct mask.
By the way, another error is that I do have some >>32 operations which breaks
your >>3 string match too. :)
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.