[PATCH] Pure python base85 fallback

Dennis Brakhane brakhane at googlemail.com
Tue Dec 30 12:34:23 CST 2008


On Tue, Dec 30, 2008 at 7:14 PM, Brendan Cully <brendan at kublai.com> wrote:
>> > +        for i in range(4, -1, -1):
>> > +            rems[i] = _b85chars[word % 85]
>> > +            word /= 85
>> Better make this word //= 85, one thing less to modify when trying to
>> get hg work with Python 3. Or does hg have to support Python 2.1?
>
> No, just python 2.3 -- I'll fix this. We may have this kind of
> division elsewhere too.

Hmm, probably divmod should be even better (and hopefully a little bit faster):
  word, mod = divmod(word, 85)
  rems[i] = _b85chars[mod]

> I wrote the base85 C code. I did start with a python version, but I
> lost it some time ago, hence this port from the C.

Ah, ok!


PS: Your reply-to header seems strange


More information about the Mercurial-devel mailing list