Skip to content

Dart2js translates << by 0 incorrectly. #6627

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

Closed
fsc8000 opened this issue Nov 8, 2012 · 3 comments
Closed

Dart2js translates << by 0 incorrectly. #6627

fsc8000 opened this issue Nov 8, 2012 · 3 comments
Labels
closed-duplicate Closed in favor of an existing report web-dart2js

Comments

@fsc8000
Copy link
Contributor

fsc8000 commented Nov 8, 2012

The attached dart program fails: It seems -1 << 0 results in 4294967295 instead of -1.

foo(a) => a << 0;

main() {
  Expect.equals(-1, foo(-1));
}


Attachment:
shl-by-0.dart (60 Bytes)

@DartBot
Copy link

DartBot commented Nov 9, 2012

This comment was originally written by [email protected]


Added Duplicate label.
Marked as being merged into #1533.

@fsc8000
Copy link
Contributor Author

fsc8000 commented Nov 9, 2012

Wouldn't it be possible to make ints that are not in the big-int range behave as expected? -1 is clearly within the precise range of JavaScript numbers.

@rakudrama
Copy link
Member

You can make things work in only 1 of the two ranges:
[-2^31, 2^31) aka signed
[0, 2^32) aka unsigned

dart2js chooses the second.

Either one is a reasonable choice, but 'unsigned' makes the encryption libraries run.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants