forked from len0rd/rockbox
Add Bob Jenkins' lookup3 32-bit and 64-bit hashes to pluginlib.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21155 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cb7f009928
commit
e0f4eafb68
3 changed files with 767 additions and 0 deletions
67
apps/plugins/lib/jhash.h
Normal file
67
apps/plugins/lib/jhash.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Andrew Mahone
|
||||
*
|
||||
* jhash.c headers
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _LIB_JHASH_H_
|
||||
#define _LIB_JHASH_H_
|
||||
#include <inttypes.h> /* defines uint32_t etc */
|
||||
#include <sys/types.h>
|
||||
#include <plugin.h>
|
||||
|
||||
/*
|
||||
hashw() -- hash an array of uint32_t into a 32-bit value
|
||||
k: pointer to the key, an array of uint32_t
|
||||
length: number of elements in the key
|
||||
initval: an initialization value
|
||||
returns the 32-bit hash
|
||||
*/
|
||||
uint32_t hashw(const uint32_t *k, size_t length, uint32_t initval);
|
||||
|
||||
/*
|
||||
hashw() -- hash an array of uint32_t into two 32-bit values
|
||||
(*pc) will be the same as the return value from hashword().
|
||||
k: pointer to the key, an array of uint32_t
|
||||
length: number of elements in the key
|
||||
pc, pb: pointers to primary and secondary initial values, also used to store
|
||||
the hash results.
|
||||
*/
|
||||
void hashw2 (const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb);
|
||||
|
||||
/*
|
||||
hashs() -- hash an array of bytes into a 32-bit value
|
||||
k: pointer to the key, an array of bytes
|
||||
length: number of elements in the key
|
||||
initval: an initialization value
|
||||
returns the 32-bit hash
|
||||
*/
|
||||
uint32_t hashs( const void *key, size_t length, uint32_t initval);
|
||||
|
||||
/*
|
||||
hashs2() -- hash an array of bytes into two 32-bit values
|
||||
k: pointer to the key, an array of bytes
|
||||
length: number of elements in the key
|
||||
pc, pb: pointers to primary and secondary initial values, also used to store
|
||||
the hash results.
|
||||
*/
|
||||
void hashs2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue