[DTrace-devel] [PATCH v2 08/20] Adjust str2hval() to match dt_strtab_hash()

Kris Van Hees kris.van.hees at oracle.com
Thu Jun 3 08:15:41 PDT 2021


Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_string.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libdtrace/dt_string.c b/libdtrace/dt_string.c
index fa5116a9..9b7fea5a 100644
--- a/libdtrace/dt_string.c
+++ b/libdtrace/dt_string.c
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  */
@@ -32,10 +32,10 @@ uint32_t str2hval(const char *p, uint32_t hval)
 	while (*p) {
 		hval = (hval << 4) + *p++;
 		g = hval & 0xf0000000;
-		if (g != 0)
-			hval ^= g >> 24;
-
-		hval &= ~g;
+		if (g != 0) {
+			hval ^= (g >> 24);
+			hval ^= g;
+		}
 	}
 
 	return hval;
-- 
2.31.1




More information about the DTrace-devel mailing list