File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / coova-chilli / src / lookup.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:48:25 2012 UTC (13 years, 1 month ago) by misho
Branches: coova-chilli, MAIN
CVS tags: v1_0_12, HEAD
coova-chilli

    1: /* 
    2:  *
    3:  * Hash lookup function.
    4:  * Copyright (C) 2003, 2004, 2005 Mondru AB.
    5:  * Copyright (c) 2007 David Bird <david@coova.com>
    6:  * 
    7:  * The contents of this file may be used under the terms of the GNU
    8:  * General Public License Version 2, provided that the above copyright
    9:  * notice and this permission notice is included in all copies or
   10:  * substantial portions of the software.
   11:  * 
   12:  */
   13: 
   14: /**
   15:  * lookup()
   16:  * see lookup3.c
   17:  **/
   18: 
   19: #include "system.h"
   20: #include <assert.h>
   21: 
   22: /* comment out to use Jenkins hash function */
   23: #define SFHASH 1
   24: 
   25: uint32_t lookup(uint8_t *k,  uint32_t length,  uint32_t initval)
   26: {
   27: #if SFHASH
   28:   extern uint32_t SuperFastHash(const char * data, int len, uint32_t hash);
   29:   return SuperFastHash(k, length, initval);
   30: #elif LITTLE_ENDIAN
   31:   extern uint32_t hashlittle(const void *key, size_t length, uint32_t initval);
   32:   return hashlittle(k, length, initval);
   33: #elif BIG_ENDIAN
   34:   extern uint32_t hashbig(const void *key, size_t length, uint32_t initval);
   35:   return hashbig(k, length, initval);
   36: #endif
   37: }
   38: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>