This commit was SVN r2295.
Add some support code to determine nearest power of 2. This commit was SVN r2170.