Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow problem with negative hashcode #61

Open
ejannink opened this issue Sep 30, 2015 · 1 comment
Open

Overflow problem with negative hashcode #61

ejannink opened this issue Sep 30, 2015 · 1 comment

Comments

@ejannink
Copy link

I have been using UniLua happily a while ago, not pivking things up again, I run into an overflowexception

It breaks in LuaTable.cs line 324 and the hashcode detexted was of a "_G" string. Clearly the (uint) cast does not accept this negative number. Changing to uint n = (uint) Math.Abs(hashcode) gives me additional problems. Any clues ?

Regards, Eelco

// LuaTable.cs line 324
private HNode GetHashNode(int hashcode)
{
uint n = (uint) hashcode;
return HashPart[n % HashPart.Length];
}

@ejannink
Copy link
Author

ejannink commented Oct 5, 2015

I solved it by adding some unchecked where int's were casted to uints, but still do not know why the problem pop's up
Hope this is of use for anyone...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant