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

Eugene Loh eugene.loh at oracle.com
Thu Jun 3 15:19:06 PDT 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 6/3/21 11:15 AM, Kris Van Hees wrote:
> 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;



More information about the DTrace-devel mailing list