Author: Gerd Isenberg
Date: 11:12:03 08/17/02
Go up one level in this thread
Hi Vincent, actually it's faster on my AthlonXP with USE_LOOKUP_XYZ defined!? Strange, i also would bet that the one without lookup is faster, which only needs 4 instructions by your definition. I don't understand this CISC-processors. Tested in wrong bishop endings and KBN-K (without ETBs), where these inlines are used quite often in eval and recognizers. In KBN-K 660KNodes versus 656KNodes. But i don't played with optimizations so far (MSC++ minimize size optimization). May be it's because m_sUDR[a][b] is accessed frequently with quite equal "a" or "b" and therefore is mostly already in first level cache - or a lack of registers. But the code is definitely shorter with lookup. #ifdef USE_LOOKUP_XYZ inline BOOL sameSquareColor(int a, int b) {return (m_sUDR[a][b]^1) & 1;} inline BOOL oppoSquareColor(int a, int b) {return m_sUDR[a][b] & 1;} #else inline BOOL sameSquareColor(int a, int b) {return (((a^b)>>3)^(a^b)^1) & 1;} inline BOOL oppoSquareColor(int a, int b) {return (((a^b)>>3)^(a^b)) & 1;} #endif (((a^b)>>3)^(a^b)) & 1; 2 xors because only one (a^b) is necessary 1 shift 1 and ------ 4 instructions see you, Gerd
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.