mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-03-02 02:06:59 +08:00
The function already existed in tidbitmap.c but more users requiring
fast hashing of 32bit ints are coming up.
Author: Andres Freund
Discussion:
https://postgr.es/m/20170914061207.zxotvyopetm7lrrp@alap3.anarazel.de
https://postgr.es/m/15ae5ae2-bc74-ebef-f9d6-34b16423cc04@blackducksoftware.com
Original-Commit: 791961f59b792fbd4f0a992d3ccab47298e79103
28 lines
455 B
C
28 lines
455 B
C
/*
|
|
* Utilities for working with hash values.
|
|
*
|
|
* Portions Copyright (c) 2017, PostgreSQL Global Development Group
|
|
*/
|
|
|
|
#ifndef HASHUTILS_H
|
|
#define HASHUTILS_H
|
|
|
|
/*
|
|
* Simple inline murmur hash implementation hashing a 32 bit ingeger, for
|
|
* performance.
|
|
*/
|
|
static inline uint32
|
|
murmurhash32(uint32 data)
|
|
{
|
|
uint32 h = data;
|
|
|
|
h ^= h >> 16;
|
|
h *= 0x85ebca6b;
|
|
h ^= h >> 13;
|
|
h *= 0xc2b2ae35;
|
|
h ^= h >> 16;
|
|
return h;
|
|
}
|
|
|
|
#endif /* HASHUTILS_H */
|