|
Packit |
83fed9 |
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* HashKit library
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* Copyright (C) 2012 Data Differential, http://datadifferential.com/
|
|
Packit |
83fed9 |
* All rights reserved.
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
83fed9 |
* modification, are permitted provided that the following conditions are
|
|
Packit |
83fed9 |
* met:
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* * Redistributions of source code must retain the above copyright
|
|
Packit |
83fed9 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* * Redistributions in binary form must reproduce the above
|
|
Packit |
83fed9 |
* copyright notice, this list of conditions and the following disclaimer
|
|
Packit |
83fed9 |
* in the documentation and/or other materials provided with the
|
|
Packit |
83fed9 |
* distribution.
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* * The names of its contributors may not be used to endorse or
|
|
Packit |
83fed9 |
* promote products derived from this software without specific prior
|
|
Packit |
83fed9 |
* written permission.
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
83fed9 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
83fed9 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
83fed9 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
83fed9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
83fed9 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
83fed9 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
83fed9 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
83fed9 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
83fed9 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
83fed9 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
83fed9 |
*
|
|
Packit |
83fed9 |
*/
|
|
Packit |
83fed9 |
|
|
Packit |
83fed9 |
#include "libhashkit/common.h"
|
|
Packit |
83fed9 |
#include "libhashkit/murmur3.h"
|
|
Packit |
83fed9 |
|
|
Packit |
83fed9 |
uint32_t hashkit_murmur3(const char *key, size_t length, void *)
|
|
Packit |
83fed9 |
{
|
|
Packit |
83fed9 |
const uint32_t seed= (0xdeadbeef * (uint32_t)length);
|
|
Packit |
83fed9 |
|
|
Packit |
83fed9 |
uint32_t ret;
|
|
Packit |
83fed9 |
MurmurHash3_x86_32(key, int(length), seed, &ret;;
|
|
Packit |
83fed9 |
|
|
Packit |
83fed9 |
return ret;
|
|
Packit |
83fed9 |
}
|