<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: In yr code twiddling yr bits</title>
	<link>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/</link>
	<description>Blog of Will McGugan</description>
	<pubDate>Sun, 07 Sep 2008 20:42:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Will</title>
		<link>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2484</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Sun, 01 Jul 2007 09:14:34 +0000</pubDate>
		<guid>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2484</guid>
		<description>So Pyglet uses bit-twiddling... Ok, now I'm sufficiently motivated to do some tests!</description>
		<content:encoded><![CDATA[<p>So Pyglet uses bit-twiddling&#8230; Ok, now I&#8217;m sufficiently motivated to do some tests!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Jones</title>
		<link>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2481</link>
		<dc:creator>Richard Jones</dc:creator>
		<pubDate>Sun, 01 Jul 2007 02:39:30 +0000</pubDate>
		<guid>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2481</guid>
		<description>Hehe. See http://pyglet.googlecode.com/svn/trunk/pyglet/image/__init__.py _nearest_pow2 :)</description>
		<content:encoded><![CDATA[<p>Hehe. See <a href="http://pyglet.googlecode.com/svn/trunk/pyglet/image/__init__.py" rel="nofollow">http://pyglet.googlecode.com/svn/trunk/pyglet/image/__init__.py</a> _nearest_pow2 :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2476</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Sat, 30 Jun 2007 21:12:31 +0000</pubDate>
		<guid>http://www.willmcgugan.com/2007/06/30/in-yr-code-twiddling-yr-bits/#comment-2476</guid>
		<description>For is_power_of_2 and next_power_of_2 you could pre-compute the first 32 (or 64 or ...) powers of two and keep them in a sorted list as well as a set

The is_power function boils down to 'return n in set_of_powers'

The next_power would become
 for x in list_of_powers:
  if x &#62;= n: return x


- Paddy.</description>
		<content:encoded><![CDATA[<p>For is_power_of_2 and next_power_of_2 you could pre-compute the first 32 (or 64 or &#8230;) powers of two and keep them in a sorted list as well as a set</p>
<p>The is_power function boils down to &#8216;return n in set_of_powers&#8217;</p>
<p>The next_power would become<br />
 for x in list_of_powers:<br />
  if x &gt;= n: return x</p>
<p>- Paddy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
