Page 2 of 2

Posted: Mon Apr 24, 2006 5:23 am
by bob

Code: Select all



int thething(int n)
{
return nthbit(n,0) ^ nthbit(n,2) ^ nthbit(n,17);
}


Posted: Mon Apr 24, 2006 5:26 am
by bob
Shorter version for this particular case:

Code: Select all

int thething(int n) 
{ 
  return (n ^ (n>>2) ^ (n>>17))&1;
}

Posted: Tue Feb 13, 2007 6:07 am
by Jonathan
Somewhat on topic, Perl 5.8 is not 64-bit safe! You think you're all fine with a 64 bit number encoded as a string, then you try to do math on it and you're screwed. A friend of mine threw together a 64 bit math library using bit arrays, but it is painfully slow when trying to do real work.

Math::BigInt is a step in the right direction, but I think it's useless when you're trying to do math on hex input to produce hex output.

Posted: Tue Feb 13, 2007 8:29 pm
by quantus
Is there documentation of this somewhere?

Posted: Wed Feb 14, 2007 9:58 pm
by Dave
I just get annoyed that apparently these 64 bit machines can't connect to some printers/plotters.