Author: Robert Hyatt
Date: 13:13:12 10/13/99
Go up one level in this thread
On October 13, 1999 at 14:33:12, Sven Reichard wrote: >On October 13, 1999 at 14:23:53, Landon Rabern wrote: > >>What is quick way to get the LSB of a 64 bit unsigned int? If I take n & -n, I >>can clear all the bits except the one that I want. Then I could either do a >>loop shifting right until I got 1 or do a log base 2. These both seem slow, is >>there a faster way? >> >>Thanks, >> >>Landon > >You can store the LSB of every possible byte in a table (256 entries). Then you >would only have to loop thru the bytes of your integer. You can still speed this >up by some binary search. > >Sven. Or use the inline assembly code in Crafty to access the BSF/BSR hardware instructions if you are running on an intel platform.
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.