Merge pull request #1375 from etschannen/release-6.1

change the IPv6 hash function to be more efficient
This commit is contained in:
Evan Tschannen 2019-03-28 17:58:54 -07:00 committed by GitHub
commit 5dd6396eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -199,9 +199,10 @@ namespace std
{
size_t operator()(const NetworkAddress& na) const
{
int result = 0;
size_t result = 0;
if (na.ip.isV6()) {
result = crc32c_append( 0xfdbeefdb, (uint8_t*)na.ip.toV6().data(), 16 );
uint16_t* ptr = (uint16_t*)na.ip.toV6().data();
result = ((size_t)ptr[5] << 32) | ((size_t)ptr[6] << 16) | ptr[7];
} else {
result = na.ip.toV4();
}