Chris's Wiki :: blog/python/CleverLargeIntegers Commentshttps://utcc.utoronto.ca/~cks/space/blog/python/CleverLargeIntegers?atomcommentsDWiki2007-08-11T18:23:01ZRecent comments in Chris's Wiki :: blog/python/CleverLargeIntegers.By Chris Siebenmann on /blog/python/CleverLargeIntegerstag:CSpace:blog/python/CleverLargeIntegers:e1b01309c077238091cff6210607bad3ae194be6Chris Siebenmann<div class="wikitext"><p>I think the bytecode compiler would have to go to a lot of work to
recover bit addressing and bit modification from these expressions,
and the recovery would fall down in more complicated situations such
as setting/clearing more than one bit at once, or checking several
bits to see if any of them are on.</p>
<p>The Python way would be either to add explicit bit addressing to
longs (and integers) or to make a new bitmap class. I think a new
class is more likely, because then you could add the ability to do
in-place modification.</p>
</div>2007-08-11T18:23:01ZBy nothings on /blog/python/CleverLargeIntegerstag:CSpace:blog/python/CleverLargeIntegers:b61b63ad15afb416478b49dd1c0967ec4a0e321bnothings<div class="wikitext"><p>Arguably (?) this is a sufficiently common idiom that perhaps the compiler should propogate some extra information around and make it available to the run-time (for example you could have a bytecode for each common type of single-bit operation).</p>
<p>Of course you might complaint it's a bad idea because this opens up a door of infinite other possible tweaks for other idioms etc., but... welcome to optimizing compilers.</p>
</div>2007-08-11T04:05:41Z