News for hackers. Stuff that matters.
Re:15-line hash table in C by art187 on Friday December 12, 2014 @12:04AM (#8738649)
This doesn't seem to use the hash in the first access. So the first hset, seems to always go to the first row of the table.

Perhaps this is what is desired (fixing roll over issue as well):

    static int (**hget(int (**t)[2], int k))[2] {
      int (**t_old)[2] =   t;                                                                                                                                                                                   
      int h = k & (SIZE - 1);
      for (t = t + h; **t && ***t != k;                                                                                                                                                                         
           h = ((h + 1) & (SIZE - 1)), t += h, t = t_old + ((t - t_old) & (SIZE - 1)));
      return t;
    }

There are no comments on this comment yet.