Negative hex to int

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jun 14 21:47:45 EDT 2006


John Machin <sjmachin at lexicon.net> writes:

> On 15/06/2006 10:31 AM, Ben Finney wrote:
> > If you want a special interpretation of the value, you'll have to
> > calculate it.
> > 
> > Example assuming you want a one's-complement interpretation::
> 
> Given that the OP had to ask the question at all, it is doubtful
> that he knows what "one's-complement" means. He may well not be
> alone -- see later.

You've pointed out something useful: a quick attempt (by me, in this
case) to describe the algorithm isn't worth much, less so if it's
already well-documented. Hopefully the original poster can consult a
more authoritative reference on the topic. Fortunately, that was also
one of my points :-)

The implementation itself seems to do the job the OP asked. I hope
it's useful in some form.

-- 
 \      "If society were bound to invent technologies which could only |
  `\   be used entirely within the law, then we would still be sitting |
_o__)    in caves sucking our feet."  -- Gene Kan, creator of Gnutella |
Ben Finney




More information about the Python-list mailing list