HaxeFoundation / HaxeFoundation/haxe

[python] Int32 wrong result for shift left operations

Open
#10,995 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

The following code give wrong result ( -4294967296 ) when the target is Python.
The correct value should be 1
```haxe
var changeBit = 31;
var result:Int32 = -2147483648 ^ (1 << changeBit);
trace("result: "+result);
```
If replace the above code with the following one, everything works:
```haxe
var result:Int32 = -2147483648 ^ (1 << 31);
trace("result: "+result);
```
Tested with :
Haxe: 4.2.5
Python 3.11.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.