Author mark.dickinson
Recipients belopolsky, draghuram, mark.dickinson, rhettinger, stutzbach
Date 2010-05-14.07:45:57
SpamBayes Score 4.18302e-06
Marked as misclassified No
Message-id <AANLkTikqeBfLCNyeMvh4CAGb-t8Qz5lXp-wWRRReb3iS@mail.gmail.com>
In-reply-to <1273788547.25.0.612184566517.issue8692@psf.upfronthosting.co.za>
Content
> Daniel Stutzbach <daniel@stutzbachenterprises.com> added the comment:
>
> Speaking of getting side-tracked, I didn't see an answer to a question I asked earlier.  I'd like to get some feedback before I proceed with revising the patch.
>
> For the find-last-set-bit (to replace log2) and count-set-bits operations, would it be worthwhile to create a pybits.h and .c that defines _Py_FindLastSetBit and _Py_CountSetBits? (with appropriate logic in the .h and configure.in to use system/compiler versions if available)

How about putting them in pymath.c and pymath.h?   Then there's no
need for new files.  There's the possible issue that the two
bit-counting methods operate on different types, though.

> There are already two implementations of find-last-set-bit in Python:
> bits_in_digit() in Objects/longobject.c and hi0bits() in Python/dtoa.c, which I could consolidate.

dtoa.c should be left alone, ideally:  it's currently almost
completely self-contained, and also very close to the original dtoa.c
from David Gay, which makes it easy to incorporate fixes from
upstream.  So it's just Objects/longobject.c that would share the
code.

> Alternately, I could just add static functions to mathmodule.c with the simplest possible implementation (they're only called once per factorial, so the performance impact is minimal).

That would work, too.
History
Date User Action Args
2010-05-14 07:46:02mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, belopolsky, draghuram, stutzbach
2010-05-14 07:45:58mark.dickinsonlinkissue8692 messages
2010-05-14 07:45:57mark.dickinsoncreate