Skip to content

Surprising negative results from 32-bit bit ops when compiling to JS #2725

Closed
@madsager

Description

@madsager

main() {
  var a = [ 0x80 ];
  print(a[0] << 24);
  print(0x80 << 24);
}

yields:

-2147483648
2147483648

The inconsistency is confusing.

Maybe we could generate JS code that yields positive numbers for 32-bit bitops?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions