Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: LSB operation

Author: Sven Reichard

Date: 11:33:12 10/13/99

Go up one level in this thread


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.



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.