[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: d3dx9_36: Simplify the computation of a 2-adic valuation
From: David Adam <david.adam.cnrs () gmail ! com>
Date: 2011-10-29 23:13:00
Message-ID: CAPZGPA7y-zWfKVzhXbsYsOJ-qbi5qKtd18dwxx=vpw1Zxy-97Q () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
please discard this patch.
It is logically wrong.
David
[Attachment #5 (text/html)]
Hello,<br><div class="gmail_quote">please discard this patch.<br>It is logically \
wrong.<br><br>David<br><br><br> </div><br>
--0015176f0c889c893c04b078253d--
["0003-Simplify-the-computation-of-a-2-adic-valuation.patch" (text/x-patch)]
From ea2d22fb135d51eecf0adbc3c25b53b0d0d4ebf1 Mon Sep 17 00:00:00 2001
From: David Adam <david.adam.cnrs@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic