Author: Severi Salminen
Date: 02:13:54 10/20/00
Go up one level in this thread
My exaple:
>>>c=0;
>>>while(B>>++c) ;
>>>c--;
>>The easiest (and slowest) way is to count the number of right shifts.
>>Something like:
>>----------
>>for (n=0;n<max_bits;n++) {
>> if (binary_number&1) break;
>> binary_number>>=1;
>>}
>>bit_position=n;
Well, the example I gave does exactly that (above) and it's also faster :)
Severi
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.