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

bitwise operators dont have desired results when compiled to javascript #3

Open
adam-singer opened this issue Aug 29, 2012 · 3 comments
Labels

Comments

@adam-singer
Copy link
Member

dart2js does not carry the signed bit when code is compiled to javascript that uses the shift operators << >> . This leads to bugs with the way bit shifting is implemented with native dart int.

@ltackmann
Copy link
Contributor

Are these bugs contained to shifting operations on BigNum or are they also apparent when doing ordinary math with bignums (which also internally rely on shifting) ?

@adam-singer
Copy link
Member Author

I think its only when shifting numbers that are negative the object fails. Internally none of numbers in the internal data structure should be negative, so all computations should be safe. I noticed this issue when dealing with negative numbers and put a safe guard in for checking a shift on negative carry http://goo.gl/Ayjnv . While I dont like this solution at the moment, it seems to work.

@adam-singer
Copy link
Member Author

google group discussion started on this https://groups.google.com/a/dartlang.org/d/topic/misc/3olrB-Fkd5U/discussion

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

No branches or pull requests

2 participants