On 2007-09-26, Ladislav Andel <[EMAIL PROTECTED]> wrote:
> Hello,
> why ~ bit-wise unary operator returns -(x+1) and not bit inversion of 
> the given integer?
>
> example:
> a = 7978
> a = ~a
> python returns -7979
>
> but I need to get back 57557 as in C language.

It's not what C language returns, but if you want 57557, you
can get it like this:

>>> (~7978) & 0xffff
57557

-- 
Grant Edwards                   grante             Yow! Do you think the
                                  at               "Monkees" should get gas on
                               visi.com            odd or even days?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to