Author: Gerd Isenberg
Date: 02:01:48 07/10/03
Go up one level in this thread
On July 10, 2003 at 02:04:20, Walter Faxon wrote: >On July 09, 2003 at 13:57:06, Gerd Isenberg wrote: > >[snip] > >>I don't know the itanium2 instructions set - may be there is some "leading" zero >>count or some fast int to float conversion, where you can pass a single isolated >>bit as int and get the position from the float exponent. >>Anyway there is still Walter Faxon's magic c-routine. >> >>Regards, >>Gerd > > >Hi, Gerd! > >You may be interested to know that Matt Taylor has developed an "even more >magical" c-routine for bit scanning. The xor and folding is replaced by a >single multiply then shift. See the thread in the Google group >"comp.lang.asm.x86" titled "Bit magic": > >http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=7a851118.0306282017.e9ce4a%40posting.google.com&prev=/groups%3Fdq%3D%26num%3D25%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.asm.x86%26start%3D25 > >I hope he posts the code here soon. > >-- Walter Hi Walter, thanks for the link - very interesting. If i compare Matt's 64-bit routine with your's, i see the 64bit multiplication and a rather huge lookup array. Did i missed something - may have a closer look at it - with the array size is someting wrong. I guess it's a unsigned shift so only, 6 bits (63-58) of the product are relevant - wow great. But no more dumb loop speed contents, at least the next days ;-) Regards, Gerd // int table[1 << 64] = {...}; // ????????????? int table[64]; // seems more reasonable int lsb(BitBoard singlebit) { // Create mask of ones based on least significant one in x. singlebit ^= (singlebit - 1); return table[(singlebit * magic) >> (64 - 6)]; }
This page took 0.01 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.