Jacek Caban : dwrite: Use BitScanForward instead of dwrite_ctz.

Alexandre Julliard julliard at winehq.org
Thu Jun 11 15:26:46 CDT 2020


Module: wine
Branch: master
Commit: f5e67202cca94fece9970711e1d28c0b95af9469
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f5e67202cca94fece9970711e1d28c0b95af9469

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jun 10 14:21:25 2020 +0200

dwrite: Use BitScanForward instead of dwrite_ctz.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/opentype.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index a6e2663ab1..e30cc4abe1 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -3518,23 +3518,6 @@ static inline unsigned int dwrite_popcount(unsigned int x)
 #endif
 }
 
-static inline unsigned int dwrite_ctz(unsigned int x)
-{
-#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
-    return __builtin_ctz(x);
-#else
-    unsigned int c = 32;
-    x &= - (int) x;
-    if (x) c--;
-    if (x & 0x0000ffff) c -= 16;
-    if (x & 0x00ff00ff) c -= 8;
-    if (x & 0x0f0f0f0f) c -= 4;
-    if (x & 0x33333333) c -= 2;
-    if (x & 0x55555555) c -= 1;
-    return c;
-#endif
-}
-
 static inline unsigned int dwrite_log2i(unsigned int x)
 {
 #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
@@ -5084,7 +5067,7 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con
         if (!count)
             return FALSE;
 
-        shift = dwrite_ctz(lookup->mask);
+        BitScanForward(&shift, lookup->mask);
         alt_index = (lookup->mask & context->glyph_infos[idx].mask) >> shift;
 
         if (alt_index > count || !alt_index)




More information about the wine-cvs mailing list