[Gerald S. Williams] > Agreed. Also, signed values needn't be 2's complement numbers, Python assumes 2's comp in several places already. > and the behavior of signed overflow isn't guaranteed (it could > saturate, for instance). But it doesn't assume anything about what happens on overflow, for either doubles or for signed integral types. > The use of doubles makes sense from a portability standpoint. I thought you were going to time this <wink>? > Or you could break out the signs and use unsigned longs with > preprocessor (and configure) checks, being careful about performance > impact. :-) Breaking out the signs means tests and branches. That's something the int_mult() code in Python tries to avoid. Unfortunately, there's a ton of tests and branches before we ever get to the multiplication, trying to guess whether this is really a "sequence * integer" case. But once we get to actually multiplying two ints, the fast path has only one test+branch (did it overflow?).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4