diff options
author | Niklas Fiekas <niklas.fiekas@backscattering.de> | 2020-06-15 12:33:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 12:33:48 (GMT) |
commit | 794e7d1ab2d7afe70fe0dd87ca8174ac860413e4 (patch) | |
tree | 48ad4d0b5a06b4f80706b16e6ca069f660b25414 /Include/pymath.h | |
parent | 25f38d7044a3a47465edd851c4e04f337b2c4b9b (diff) | |
download | cpython-794e7d1ab2d7afe70fe0dd87ca8174ac860413e4.zip cpython-794e7d1ab2d7afe70fe0dd87ca8174ac860413e4.tar.gz cpython-794e7d1ab2d7afe70fe0dd87ca8174ac860413e4.tar.bz2 |
bpo-29782: Consolidate _Py_Bit_Length() (GH-20739)
In GH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better
location. GH-20518 added a more appropriate header file for bit utilities. It
also shows how to properly use intrinsics. This allows reconsidering bpo-29782.
* Move the function to the new header.
* Changed return type to match __builtin_clzl() and reviewed usage.
* Use intrinsics where available.
* Pick a fallback implementation suitable for inlining.
Diffstat (limited to 'Include/pymath.h')
-rw-r--r-- | Include/pymath.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/Include/pymath.h b/Include/pymath.h index 63ca972..f869724 100644 --- a/Include/pymath.h +++ b/Include/pymath.h @@ -227,12 +227,4 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); * behavior. */ #define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) -/* Return the smallest integer k such that n < 2**k, or 0 if n == 0. - * Equivalent to floor(log2(x))+1. Also equivalent to: bitwidth_of_type - - * count_leading_zero_bits(x) - */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(unsigned int) _Py_bit_length(unsigned long d); -#endif - #endif /* Py_PYMATH_H */ |