Old bug in longobject.c + fix
Duncan Booth
duncan at NOSPAMrcp.co.uk
Mon Aug 19 12:08:11 EDT 2002
Tim Peters <tim.one at comcast.net> wrote in
news:mailman.1029768207.30159.python-list at python.org:
>> a->ob_digit[j] is an unsigned short. When you try to left shift it, it
>> is autmoatically promoted to unsigned int.
>
> Not necessarily: unsigned short promotes to signed int *if* the platform
> int is capable of representing all platform unsigned short values.
Oops, my C is a bit rustier than I thought. Time to go and reread the
standard methinks.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list