¡@

Home 

python Programming Glossary: lnum

Is there a faster way to convert an arbitrary large integer to a big endian sequence of bytes?

http://stackoverflow.com/questions/4358285/is-there-a-faster-way-to-convert-an-arbitrary-large-integer-to-a-big-endian-sequ

code to do this from struct import pack as _pack def packl lnum pad 1 if lnum 0 raise RangeError Cannot use packl to convert.. from struct import pack as _pack def packl lnum pad 1 if lnum 0 raise RangeError Cannot use packl to convert a negative integer.. convert a negative integer to a string. count 0 l while lnum 0 l.append lnum 0xffffffffffffffffL count 1 lnum 64 if count..