Skip to content

Performance optimization of &-operator causes miscalculation #3258

@Baekalfen

Description

@Baekalfen

Commit 6d9daa0 causes a wrong result to be calculated in the example below. There seems to be something with the negative number, which makes it act unexpectedly.

This code snippet prints 1:

x = -1
x &= 0xFF
print(x)

Before the commit, the code above would print 255, which is also the case in CPython and PyPy without Cython.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions