Skip to content

Bug in 64-bit hash. #1

Description

@JohnPile

In the formula on lines 135 and 154, you perform a bitwise OR when computing a 64-bit hash, like so:

return is32BitHash ? c : (c | ((long) (b << 32)));

This works when c is non-negative, but for negative values of c, the left-most 32 bits will always be 0xffffffff. So (c | anything << 32) will always equal c. I suggest the following replacement:

return is32BitHash ? c : c & 0xffffffffl | (long) b << 32;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions