Author: Bo Persson
Date: 07:00:51 01/16/99
Go up one level in this thread
This is my solution for VC6, not perfect but working! // warning C4035: 'BSF' : no return value #pragma warning(disable : 4035) inline unsigned BSF(unsigned Bits) { __asm mov eax,[Bits] __asm bsf eax,eax } #pragma warning(default : 4035) inline SQUARE BitBoard::GetLowMember() { if (Half[0] != 0) { const unsigned BitFound = BSF(Half[0]); Half[0] ^= (1 << BitFound); return static_cast<SQUARE>(BitFound); } else { const unsigned BitFound = BSF(Half[1]); Half[1] ^= (1 << BitFound); return static_cast<SQUARE>(BitFound + 4 * FILES); } } /* GetLowMember */ VC6 still puts the argument 'Bits' on the stack and reloads it, so you loose a few instructions but still come out faster *on a PII*. Compared to a 16-bit table lookup, the BSF is faster on a PII, makes no difference on an AMD K6 and is actually *slower* on a Pentium 133! BTW, you don't have to invent new operators for C/C++ to improve inlining. Many years ago I used the TopSpeed C++ that solved regsiter assignment with special pragmas, like: #pragma call(reg_param=>(cx,dx), reg_return=>ax) Worked fine! Bo Persson bop@malmo.mail.telia.com
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.