◐ Shell
clean mode source ↗

gh-96821: Fix undefined behaviour in `audioop.c` by matthiasgoergens · Pull Request #96923 · python/cpython

Left-shifting negative numbers is undefined behaviour.

Fortunately, multiplication works just as well, is defined behaviour,
and gets compiled to the same machine code as before by optimizing
compilers.

@blurb-it

@matthiasgoergens

This was referenced

Sep 21, 2022

@matthiasgoergens

@matthiasgoergens

JelleZijlstra

mdickinson

@matthiasgoergens

mdickinson

mdickinson

mdickinson

JelleZijlstra

mpage pushed a commit to mpage/cpython that referenced this pull request

Oct 11, 2022
* pythongh-96821: Fix undefined behaviour in `audioop.c`

Left-shifting negative numbers is undefined behaviour.

Fortunately, multiplication works just as well, is defined behaviour,
and gets compiled to the same machine code as before by optimizing
compilers.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>