Files
postgresql/src/include/utils/hashutils.h
Andres Freund c0fda304df Backport: Add inline murmurhash32(uint32) function.
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
2018-01-29 11:24:57 -08:00

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 */