mojoshader_common.c
changeset 734 1f69fc50c79c
parent 733 1b6d68fabe46
child 735 78c882b8c813
equal deleted inserted replaced
733:1b6d68fabe46 734:1f69fc50c79c
   132     } // for
   132     } // for
   133 
   133 
   134     return 0;
   134     return 0;
   135 } // hash_remove
   135 } // hash_remove
   136 
   136 
       
   137 
       
   138 // this is djb's xor hashing function.
       
   139 uint32 hash_hash_string(const void *_sym)
       
   140 {
       
   141     register const char *sym = (const char *) _sym;
       
   142     register uint32 hash = 5381;
       
   143     while (*sym)
       
   144         hash = ((hash << 5) + hash) ^ *(sym++);
       
   145     return hash;
       
   146 } // hash_hash_string
       
   147 
       
   148 int hash_keymatch_string(const void *a, const void *b)
       
   149 {
       
   150     return (strcmp((const char *) a, (const char *) b) == 0);
       
   151 } // hash_keymatch_string
       
   152 
   137 // end of mojoshader_common.c ...
   153 // end of mojoshader_common.c ...
   138 
   154