Hello, please discard this patch. It is logically wrong. David
From ea2d22fb135d51eecf0adbc3c25b53b0d0d4ebf1 Mon Sep 17 00:00:00 2001 From: David Adam <david.adam.c...@gmail.com> Date: Sat, 29 Oct 2011 21:24:27 +0200 Subject: Simplify the computation of a 2-adic valuation
--- dlls/d3dx9_36/texture.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 20d8880..41fb3b4 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -34,16 +34,7 @@ static BOOL is_pow2(UINT num) /* Returns the smallest power of 2 which is greater than or equal to num */ static UINT make_pow2(UINT num) { - UINT result = 1; - - /* In the unlikely event somebody passes a large value, make sure we don't enter an infinite loop */ - if (num >= 0x80000000) - return 0x80000000; - - while (result < num) - result <<= 1; - - return result; + return (UINT)( ceil( log(num) / log(2) ) ); } static HRESULT get_surface(D3DRESOURCETYPE type, LPDIRECT3DBASETEXTURE9 tex, -- 1.7.6