Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Interesting numbers about hashing - 32 bits are clearly not enough

Author: Sune Fischer

Date: 08:03:45 12/07/01

Go up one level in this thread



Try this:

char *PrintInt64(__int64 x, char *s)
{
int  MEGA=1000000;
__int64 a = x/((__int64) MEGA);
__int64 b = x%((__int64) MEGA);

  if (a==0)
  {
     sprintf(s,"%d",b);
     return(s);
  }

  if (b>=MEGA/10)
     sprintf(s,"%d%d",a,b);
  else if (b<MEGA/10)
     sprintf(s,"%d0%d",a,b);
  else if ((b<MEGA/100)
     sprintf(s,"%d00%d",a,b);
  else if ((b<MEGA/1000)
     sprintf(s,"%d000%d",a,b);
  else if ((b<MEGA/10000)
     sprintf(s,"%d0000%d",a,b);
  else if ((b<MEGA/100000)
     sprintf(s,"%d00000%d",a,b);

  return(s);
}



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.