Skip to content

Commit

Permalink
Adjust hashing in logging source gen (#5782)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekgh authored Jan 9, 2025
1 parent 422bd6d commit e98606a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ static int GetNonRandomizedHashCode(string s)
result = (c ^ result) * Mult;
}

const uint NegativeMask = 0x7FFFFFFF;
return (int)(result & NegativeMask); // Ensure the result is non-negative
int ret = (int)result;
return ret == int.MinValue ? 0 : Math.Abs(ret); // Ensure the result is non-negative
}

static bool ShouldStringifyParameter(LoggingMethodParameter p)
Expand Down

0 comments on commit e98606a

Please sign in to comment.