From 5ba670d55150f7c9dcf590e5139dcc9945f65c53 Mon Sep 17 00:00:00 2001 From: Jithin Jose Date: Fri, 18 Dec 2020 10:12:54 -0800 Subject: [PATCH] Use DJB2a hash algorithm in getHostHash() [ROCm/rccl-tests commit: 0aeba157db77cc9e99186639bf71368b74fb90e2] --- projects/rccl-tests/src/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rccl-tests/src/common.h b/projects/rccl-tests/src/common.h index b69d071606..6fc6bfdd69 100644 --- a/projects/rccl-tests/src/common.h +++ b/projects/rccl-tests/src/common.h @@ -174,10 +174,10 @@ static void getHostName(char* hostname, int maxlen) { #include static uint64_t getHostHash(const char* string) { - // Based on DJB2, result = result * 33 + char + // Based on DJB2a, result = result * 33 ^ char uint64_t result = 5381; for (int c = 0; string[c] != '\0'; c++){ - result = ((result << 5) + result) + string[c]; + result = ((result << 5) + result) ^ string[c]; } return result; }