This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

solaris8 error


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);
}





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]