how to get the thighest bit position in big integers?

mmgarvey at gmx.de mmgarvey at gmx.de
Tue Oct 7 12:19:33 EDT 2008


> See also http://bugs.python.org/issue3439
> where there's a proposal to expose the _PyLong_NumBits method.  This
> would give an O(1) solution.

> > In every case I can think of, I've wanted (0).numbits() to be 0.

Here is surely the wrong place to respond to
  http://bugs.python.org/msg71384
but I want to make clear that I think that (0).numbits()==-1
is the natural solution. At least for all square-and-multiply-like
algorithms needed in cryptography (modular exponentiation, point
multiplication
on elliptic curves, generation of lucas numbers, etc) this property
of .numbits()
would be needed.




More information about the Python-list mailing list