Writing an emulator in python - implementation questions (for performance)
Dave Angel
davea at ieee.org
Thu Nov 12 11:40:12 EST 2009
Santiago Romero wrote:
>>> I'm trying to port (just for fun), my old Sinclair Spectrum emulator,
>>> A
>> <snip>
> Do you mean:
>
> page =ddress / 16384
> index =ddress MOD 16384
>
> ?
>
> Or, better, with:
>
> page =ddress >> 14
> index =ddress & 16383
>
> ?
> <snip>
>
How about
page, index = divmod(address, 16384)
More information about the Python-list
mailing list