Weird 'and' result...

Artur M. Piwko pipen at beast_tu_kielce.pl
Fri Jun 20 20:06:32 EDT 2003


In the darkest hour on Fri, 20 Jun 2003 19:52:17 -0400,
Peter Hansen <peter at engcorp.com> screamed:
>> And it should be 'ee5ccea7'. Am I missing something?
> 
> I don't know the details, since the first value won't fit
> in an int, it's quietly making it a long, then treating the
> second value as "-1" and/or basically sign-extending it
> to an appropriate size to do the AND for you...
> 
> Change it to 0xffffffffL (note the L) and it works "better".
> 

Oh, so python converted my mask to the size of first number:
-1L == 0xffffffffffffffff. That's why it "didn't" work.
I have to change a little bit my C-ish thinking... (-;

Thanks

-- 
Before the Goat of Mendes... we all must take our turn   |  Artur M. Piwko
Into the magic circle... where still the fire burns      |  mailto:s/_/./
We're spinning round and round... until one takes a fall | -- Mercyful Fate
The fallen one will not return, the fallen one must burn | "Witches' Dance"




More information about the Python-list mailing list