• Disconnect3d's avatar
    Remove redundant check from arraymodule b_getitem (GH-14676) · 13ab570f
    Disconnect3d yazdı
    
    
    The `arraymodule`'s `b_getitem` function returns a `PyLong` converted 
    from `arrayobject`'s array, by dereferencing a pointer to `char`.
    
    When the `char` type is `signed char`, the `if (x >= 128) x -= 256;` comparison/code is redundant because a `signed char` will have a value of `[-128, 127]` and so `x` will never be greater or equal than 128.
    
    This check was indeed needed for situations where a given compiler would assume `char` being `unsigned char` which would make `x` in `[0, 256]` range.
    
    However, the check can be removed if we cast the `ob_item` into a signed char pointer (`signed char*`) instead of `char*`.
    
    This PR/commit introduces this change.
    13ab570f
Adı
Son kayıt (commit)
Son güncelleme
.azure-pipelines Loading commit data...
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
m4 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README.rst Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...