Conversion of 24bit binary to int

Patrick Maupin pmaupin at speakeasy.net
Wed Nov 12 14:29:42 EST 2003


Alex Martelli wrote:
 
> r512 = xrange(512)
> 
> def doblock(SI, SO, IA, OA, r512=r512):
>     ii = SI
>     io = SO
>     for i in r512:
>        OA[io:io+3] = IA[ii+2:ii-1:-1]
>        ii += 3
>        io += 4


It's my guess this would be faster using array.array
in combination with extended slicing, as per the list
example I gave in a previous message, even though I'm
still not bored enough to time it :)   (The for loop
in my previous example only requires 3 interations,
rather than 512 as in this example.)

Pat




More information about the Python-list mailing list