Ignore:
Timestamp:
2005-04-08T15:41:31+12:00 (19 years ago)
Author:
kjdon
Message:

added in x++ -> ++x changes submitted by Emanuel Dejanu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mgpp/lib/perf_hash.cpp

    r3365 r9612  
    213213  Stack[StackPos].v = v;
    214214  Stack[StackPos].m = 0;
    215   StackPos++;
     215  ++StackPos;
    216216  while (StackPos)
    217217    {
    218218      int m, b;
    219       StackPos--;
     219      --StackPos;
    220220      e = Stack[StackPos].e;
    221221      v = Stack[StackPos].v;
     
    277277  /* build list of edges for each node */
    278278  for (v = 1; v <= n; FIRST[v++] = 0);
    279   for (e = 1; e <= m; e++)
     279  for (e = 1; e <= m; ++e)
    280280    {
    281281      NEXT[A + e] = FIRST[NODEa[e]];
     
    293293  S.sp = 0;         /* empty the stack */
    294294  mk[0] = ERASED;       /* a sentinel for the test below */
    295   for (v = 1; v <= n; v++)
     295  for (v = 1; v <= n; ++v)
    296296    {
    297297      if (mk[e = norm (unique (v))] == MEMBER)
     
    324324      *n = (int) (num * c + 1);
    325325      /* initialize tables of random integers */
    326       for (i = 0; i < MAX_CH; i++)
    327     for (j = 0; j < MAX_L; j++)
     326      for (i = 0; i < MAX_CH; ++i)
     327    for (j = 0; j < MAX_L; ++j)
    328328      {
    329329#ifndef STRUCT
     
    340340
    341341      /* compute an edge (NODEa[e], NODEb[e], NODEc[e]) for each word */
    342       for (e = 1; e <= num; e++)
     342      for (e = 1; e <= num; ++e)
    343343    {
    344344      /*generate an edge corresponding to the ith word */
     
    363363          if (++j >= MAX_L)
    364364        j = 0;
    365           w++;
     365          ++w;
    366366        }
    367367      while (--l);
     
    460460
    461461  /*for each word compute its place in hash table and check if correct */
    462   for (e = 1; e <= m; e++)
     462  for (e = 1; e <= m; ++e)
    463463    {
    464464      if ((e - 1) != (g[NODEa[e]] ^ g[NODEb[e]] ^ g[NODEc[e]]))
     
    538538  printf ("#define _HFM %d\n#define _HXL %d\n", m, MAX_L);
    539539  printf ("#define _HFA %d\n\nstatic int g[_HFN] = {\n", lc - fc + 1);
    540   for (i = 1; i < n; i++)
     540  for (i = 1; i < n; ++i)
    541541    {
    542542      if (i % 8 == 0)
     
    547547
    548548  printf ("static int mt1[_HFA][_HXL] = {\n");
    549   for (j = fc; j < lc; j++)
     549  for (j = fc; j < lc; ++j)
    550550    {
    551551      printf ("{");
    552       for (i = 0; i < MAX_L - 1; i++)
     552      for (i = 0; i < MAX_L - 1; ++i)
    553553    printf ("%*d,", w, tb0[j][i]);
    554554      printf ("%*d},\n", w, tb0[j][MAX_L - 1]);
    555555    }
    556556  printf ("{");
    557   for (i = 0; i < MAX_L - 1; i++)
     557  for (i = 0; i < MAX_L - 1; ++i)
    558558    printf ("%*d,", w, tb0[lc][i]);
    559559  printf ("%*d}\n", w, tb0[lc][MAX_L - 1]);
     
    561561
    562562  printf ("static int mt2[_HFA][_HXL] = {\n");
    563   for (j = fc; j < lc; j++)
     563  for (j = fc; j < lc; ++j)
    564564    {
    565565      printf ("{");
    566       for (i = 0; i < MAX_L - 1; i++)
     566      for (i = 0; i < MAX_L - 1; ++i)
    567567    printf ("%*d,", w, tb1[j][i]);
    568568      printf ("%*d},\n", w, tb1[j][MAX_L - 1]);
    569569    }
    570570  printf ("{");
    571   for (i = 0; i < MAX_L - 1; i++)
     571  for (i = 0; i < MAX_L - 1; ++i)
    572572    printf ("%*d,", w, tb1[lc][i]);
    573573  printf ("%*d}\n", w, tb1[lc][MAX_L - 1]);
     
    575575
    576576  printf ("static int mt3[_HFA][_HXL] = {\n");
    577   for (j = fc; j < lc; j++)
     577  for (j = fc; j < lc; ++j)
    578578    {
    579579      printf ("{");
    580       for (i = 0; i < MAX_L - 1; i++)
     580      for (i = 0; i < MAX_L - 1; ++i)
    581581    printf ("%*d,", w, tb2[j][i]);
    582582      printf ("%*d},\n", w, tb2[j][MAX_L - 1]);
    583583    }
    584584  printf ("{");
    585   for (i = 0; i < MAX_L - 1; i++)
     585  for (i = 0; i < MAX_L - 1; ++i)
    586586    printf ("%*d,", w, tb2[lc][i]);
    587587  printf ("%*d}\n", w, tb2[lc][MAX_L - 1]);
     
    606606
    607607  MAX_L = 1;
    608   for (i = 0; i < num; i++)
     608  for (i = 0; i < num; ++i)
    609609    {
    610610      unsigned len = keys[i][0];
    611611      u_char *s = keys[i] + 1;
    612       for (; len; len--, s++)
     612      for (; len; len--, ++s)
    613613    translate[*s] = 1;
    614614      if (i)
     
    621621    }
    622622  j = 0;
    623   for (i = 0; i < 256; i++)
     623  for (i = 0; i < 256; ++i)
    624624    if (translate[i])
    625625      translate[i] = j++;
     
    657657    Xfree (g);
    658658#ifndef STRUCT
    659   for (i = 0; i < MAX_CH; i++)
     659  for (i = 0; i < MAX_CH; ++i)
    660660    {
    661661      if (tb0 && tb0[i])
     
    673673    Xfree (tb2);
    674674#else
    675   for (i = 0; i < MAX_CH; i++)
     675  for (i = 0; i < MAX_CH; ++i)
    676676    if (tb && tb[i])
    677677      Xfree (tb[i]);
     
    697697  tb1 = Xmalloc (sizeof (int *) * MAX_CH);
    698698  tb2 = Xmalloc (sizeof (int *) * MAX_CH);
    699   for (i = 0; i < MAX_CH; i++)
     699  for (i = 0; i < MAX_CH; ++i)
    700700    {
    701701      if (tb0)
     
    718718#else
    719719  tb = (tb_entry **)Xmalloc (sizeof (struct tb_entry *) * MAX_CH);
    720   for (i = 0; i < MAX_CH; i++)
     720  for (i = 0; i < MAX_CH; ++i)
    721721    if (tb)
    722722      if (!(tb[i] = (tb_entry *)Xmalloc (sizeof (struct tb_entry) * MAX_L)))
     
    809809
    810810  /* [RPAP - Jan 97: Endian Ordering] */
    811   for (i = 0; i < phd->MAX_N + 1; i++)
     811  for (i = 0; i < phd->MAX_N + 1; ++i)
    812812    HTONSI(phd->g[i]);
    813813
     
    815815
    816816  /* [RPAP - Jan 97: Endian Ordering] */
    817   for (i = 0; i < phd->MAX_N + 1; i++)
     817  for (i = 0; i < phd->MAX_N + 1; ++i)
    818818    NTOHSI(phd->g[i]);
    819819
    820820#ifndef STRUCT
    821   for (i = 0; i < phd->MAX_CH; i++)
     821  for (i = 0; i < phd->MAX_CH; ++i)
    822822    {
    823823      /* [RPAP - Jan 97: Endian Ordering] */
    824824      int j;
    825       for (j = 0; j < phd->MAX_L; j++)
     825      for (j = 0; j < phd->MAX_L; ++j)
    826826    {
    827827      HTONSI(phd->tb0[i][j]);
     
    838838
    839839      /* [RPAP - Jan 97: Endian Ordering] */
    840       for (j = 0; j < phd->MAX_L; j++)
     840      for (j = 0; j < phd->MAX_L; ++j)
    841841    {
    842842      NTOHSI(phd->tb0[i][j]);
     
    846846    }
    847847#else
    848   for (i = 0; i < phd->MAX_CH; i++)
     848  for (i = 0; i < phd->MAX_CH; ++i)
    849849    {
    850850      /* [RPAP - Jan 97: Endian Ordering] */
    851851      int j;
    852       for (j = 0; j < phd->MAX_L; j++)
     852      for (j = 0; j < phd->MAX_L; ++j)
    853853    {
    854854      HTONSL(phd->tb[i][j].tb0);
     
    861861
    862862      /* [RPAP - Jan 97: Endian Ordering] */
    863       for (j = 0; j < phd->MAX_L; j++)
     863      for (j = 0; j < phd->MAX_L; ++j)
    864864    {
    865865      NTOHSL(phd->tb[i][j].tb0);
     
    899899  phd->tb1 = Xmalloc (sizeof (int *) * phd->MAX_CH);
    900900  phd->tb2 = Xmalloc (sizeof (int *) * phd->MAX_CH);
    901   for (i = 0; i < phd->MAX_CH; i++)
     901  for (i = 0; i < phd->MAX_CH; ++i)
    902902    {
    903903      if (phd->tb0)
     
    917917      if (phd->g)
    918918    Xfree (phd->g);
    919       for (i = 0; i < MAX_CH; i++)
     919      for (i = 0; i < MAX_CH; ++i)
    920920    {
    921921      if (phd->tb0 && phd->tb0[i])
     
    939939
    940940  /* [RPAP - Jan 97: Endian Ordering] */
    941   for (i = 0; i < phd->MAX_N + 1; i++)
     941  for (i = 0; i < phd->MAX_N + 1; ++i)
    942942    NTOHSI(phd->g[i]);
    943943
    944   for (i = 0; i < phd->MAX_CH; i++)
     944  for (i = 0; i < phd->MAX_CH; ++i)
    945945    {
    946946      int j;
     
    954954
    955955      /* [RPAP - Jan 97: Endian Ordering] */
    956       for (j = 0; j < phd->MAX_L; j++)
     956      for (j = 0; j < phd->MAX_L; ++j)
    957957    {
    958958      NTOHSI(phd->tb0[i][j]);
     
    963963#else
    964964  phd->tb = (struct tb_entry **)Xmalloc (sizeof (struct tb_entry *) * phd->MAX_CH);
    965   for (i = 0; i < phd->MAX_CH; i++)
     965  for (i = 0; i < phd->MAX_CH; ++i)
    966966    if (phd->tb)
    967967      if (!(phd->tb[i] = (struct tb_entry *)Xmalloc (sizeof (struct tb_entry) * phd->MAX_L)))
     
    973973      if (phd->g)
    974974    Xfree (phd->g);
    975       for (i = 0; i < MAX_CH; i++)
     975      for (i = 0; i < MAX_CH; ++i)
    976976    if (phd->tb && phd->tb[i])
    977977      Xfree (phd->tb[i]);
     
    985985
    986986  /* [RPAP - Jan 97: Endian Ordering] */
    987   for (i = 0; i < phd->MAX_N + 1; i++)
     987  for (i = 0; i < phd->MAX_N + 1; ++i)
    988988    NTOHSI(phd->g[i]);
    989989
    990   for (i = 0; i < phd->MAX_CH; i++)
     990  for (i = 0; i < phd->MAX_CH; ++i)
    991991    {
    992992      int j;
     
    996996
    997997      /* [RPAP - Jan 97: Endian Ordering] */
    998       for (j = 0; j < phd->MAX_L; j++)
     998      for (j = 0; j < phd->MAX_L; ++j)
    999999    {
    10001000      NTOHSL(phd->tb[i][j].tb0);
     
    10151015  if (phd->g)
    10161016    Xfree (phd->g);
    1017   for (i = 0; i < phd->MAX_CH; i++)
     1017  for (i = 0; i < phd->MAX_CH; ++i)
    10181018    if (phd->tb && phd->tb[i])
    10191019      Xfree (phd->tb[i]);
     
    10511051      if (++i >= phd->MAX_L)
    10521052    i = 0;
    1053       l--;
    1054       s++;
     1053      --l;
     1054      ++s;
    10551055    }
    10561056  if (u == v && ++v >= phd->MAX_N)
Note: See TracChangeset for help on using the changeset viewer.