solaris8 error

Benjamin Franks benjamin@dzhan.com
Sat Aug 10 11:15:00 GMT 2002


The following c hashing function has compiled/executed fine on various
unices (linux, freebsd, some solaris versions).  However, although it
compiles ok on Solaris 8, it faults when it is called.  Can someone
familiar with Solaris weigh in on why this relatively standard hashing
function (ala P.J.  Weinberger) would be causing trouble on Solaris 8?
This is still for a 32bit ultra1, so not a 64-bit setup, and using the gcc
compiler.

Thanks.
------

unsigned int hashpjw (const void *key) {
   const char *ptr;
   unsigned int val;

   val=0;
   ptr=key;
   while (*ptr != '\0') {
      int tmp;
      val = (val << 4) + (*ptr);
      if (tmp = (val & 0xf0000000)) {
         val = val ^ (tmp >> 24);
         val &= ~tmp;
      }
   ptr++;
   }
   return (val%BIG_MAX);
}






More information about the Gcc-help mailing list