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

Exception throw in InitializeTable #19

Closed
AngeloMascaro opened this issue Oct 21, 2018 · 2 comments
Closed

Exception throw in InitializeTable #19

AngeloMascaro opened this issue Oct 21, 2018 · 2 comments

Comments

@AngeloMascaro
Copy link

The following exception is

Exception IndexOutOfRangeException Source = Crc32Test Message = Index was outside the bounds of the array. TargetSite = UInt32[] InitializeTable(UInt32) Stack =
at this line:
createTable[entry] = entry;
I added this check
System.Diagnostics.Debug.Assert(entry >= 0 && entry < 256); // ANGELO if(entry >= 0 && entry < 256) // ANGELO createTable[entry] = entry;
but probably it would be better to add test and a break in the inner loop, where entry is modified,
Since I didn't know the algorithm and I didn't fully analized the code, I'm not sure about what is correct.

@AngeloMascaro
Copy link
Author

I add an old version of your code.
Now I replace it with the new code and I test it again and I let you know.

@AngeloMascaro
Copy link
Author

I confirm that the exception does not happen with the current version. The old version had entry as for loop variable.

@damieng damieng closed this as completed Jan 30, 2019
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

2 participants