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

Unary bitwise complement "~" in dart2js is wrong #31569

Closed
jumperchen opened this Issue Dec 7, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@jumperchen

jumperchen commented Dec 7, 2017

for example,

var i = 0;
print(~i);

It should print -1 not 4294967295

Dart2js will compile it to
~i >>> 0
Not ~i only

@rakudrama

This comment has been minimized.

Show comment
Hide comment
@rakudrama

rakudrama Dec 7, 2017

Member

dart2js and DDC chose to restrict bit operations to the range [0, 2^32).
The other choice was [-2^31, 2^32).
The unsigned range makes more code 'just work'.
See: https://github.com//issues/25493

Member

rakudrama commented Dec 7, 2017

dart2js and DDC chose to restrict bit operations to the range [0, 2^32).
The other choice was [-2^31, 2^32).
The unsigned range makes more code 'just work'.
See: https://github.com//issues/25493

@rakudrama rakudrama closed this Dec 7, 2017

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