Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb7f3eb3

Browse files
committed
Add hash_combine64.
Extracted from a larger patch by Amul Sul, with some comment additionsby me.Discussion:http://postgr.es/m/20171024113004.hn5qajypin4dy5sw@alap3.anarazel.de
1 parent60651e4 commitb7f3eb3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/include/utils/hashutils.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#defineHASHUTILS_H
99

1010
/*
11-
* Combine two hash values, resulting in another hash value, with decent bit
12-
* mixing.
11+
* Combine two32-bithash values, resulting in another hash value, with
12+
*decent bitmixing.
1313
*
1414
* Similar to boost's hash_combine().
1515
*/
@@ -20,6 +20,18 @@ hash_combine(uint32 a, uint32 b)
2020
returna;
2121
}
2222

23+
/*
24+
* Combine two 64-bit hash values, resulting in another hash value, using the
25+
* same kind of technique as hash_combine(). Testing shows that this also
26+
* produces good bit mixing.
27+
*/
28+
staticinlineuint64
29+
hash_combine64(uint64a,uint64b)
30+
{
31+
/* 0x49a0f4dd15e5a8e3 is 64bit random data */
32+
a ^=b+0x49a0f4dd15e5a8e3+ (a <<54)+ (a >>7);
33+
returna;
34+
}
2335

2436
/*
2537
* Simple inline murmur hash implementation hashing a 32 bit integer, for

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp