Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Overflow issue #52

Open
Phlosioneer opened this issue May 22, 2016 · 1 comment
Open

Overflow issue #52

Phlosioneer opened this issue May 22, 2016 · 1 comment

Comments

@Phlosioneer
Copy link
Contributor

So I figured out the issues I was having yesterday. I checked my sha1 against yours, and it matches perfectly with yours. Investigating further, I figured out that there was an integer overflow occurring in the addi instruction. I don't know why your rust didn't catch it, while mine did, but the code, pif, and rom are exactly the same.

In any case, I was forced to implement some small amount of overflow handling in #51. It might help anyone else out there who has the same issue. I'm not sure why rust was overflowing - I think it was because it was trying to add two u64's that represented negative numbers. Not sure if that means i64 would have been more appropriate, or i32, or whatever. I just implemented it bit-wise, checking for overflow manually.

Now that I think about it, I think my implementation breaks the 64bit-mode. I don't know. Thoughts?

@yupferris
Copy link
Owner

I've left a comment with my thoughts on the PR.

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

No branches or pull requests

2 participants