[chbot] !!!!!!!! Choc fish challenge 2 !!!!!!!!!

Cass Jones jones.cass at gmail.com
Mon Aug 1 08:47:49 BST 2011


Not trying to break the time frame rules, but @Mark, I would imagine
it only returns 1 if x is 1, otherwise it returns 0, assuming a 32 bit
or less integer

On Mon, Aug 1, 2011 at 5:59 PM, Mark Atherton <markaren1 at xtra.co.nz> wrote:
> Hi Andre,
>
> returns 1
>
> Haven't seen you for years, hope you are well.
>
> Regards,
>
> Mark Atherton
>
> At 04:09 p.m. 1/08/2011, you wrote:
>>To make up for my massive blunder, I'll offer a replacement fish for an
>>explanation of what the following algorithm does. We'll go with the same
>>timeframe as before, and I'll endeavor not to reply myself.
>>
>>unsigned int function(unsigned int x)
>>{
>>   x--;
>>   x |= x >> 1;
>>   x |= x >> 2;
>>   x |= x >> 4;
>>   x |= x >> 8;
>>   x |= x >> 16;
>>   return x + 1;
>>}
>>



More information about the Chchrobotics mailing list