Author: Gerd Isenberg
Date: 10:50:32 06/18/02
Go up one level in this thread
On June 18, 2002 at 13:24:57, Eugene Nalimov wrote: >Your version of popcnt use behaviour that is not guaranteed to work on the >future CPUs. (Actually there is no guarantee that it works even on the current >CPUs) > >Thanks, >Eugene > You mean this one? >__forceinline unsigned int BitSearch(BitBoard bb) >{ >#ifdef _M_IX86 > __asm > { > bsf eax,[bb+4] > xor eax, 32 > bsf eax,[bb] > } >#else You are right here. But it seems to work on all x86 cpu's i tried so far (intel/amd). The target register is not affected, if source operand is zero. No idea under which circumstances the register may change. In a debug version i compared the found bit of this code with an safe one inside an ASSERT macro. No assertion occurs during this test. So long as i only play tournaments with my program on my own hardware i do not fear about it. Next cpu generation will solve this potential problem with 64bit registers and hopefully fast bsf/bsr reg64, reg64/mem64. 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.