Jacek Caban : dwrite: Use BitScanReverse instead of dwrite_log2i.
Alexandre Julliard
julliard at winehq.org
Thu Jun 11 15:26:46 CDT 2020
Module: wine
Branch: master
Commit: ce4083ecccf0bab6f5e20338f61aeac711fa3706
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ce4083ecccf0bab6f5e20338f61aeac711fa3706
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jun 10 14:21:50 2020 +0200
dwrite: Use BitScanReverse instead of dwrite_log2i.
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 | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index e30cc4abe1..cb79a68d59 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -3518,36 +3518,6 @@ static inline unsigned int dwrite_popcount(unsigned int x)
#endif
}
-static inline unsigned int dwrite_log2i(unsigned int x)
-{
-#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
- return __builtin_clz(x) ^ 0x1f;
-#else
- static const unsigned int l[] =
- {
- ~0u, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- };
- unsigned int i;
-
- return (i = x >> 16) ? (x = i >> 8) ? l[x] + 24 : l[i] + 16 : (i = x >> 8) ? l[i] + 8 : l[x];
-#endif
-}
-
static float opentype_scale_gpos_be_value(WORD value, float emsize, UINT16 upem)
{
return (short)GET_BE_WORD(value) * emsize / upem;
@@ -4650,7 +4620,7 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
if ((feature->flags & FEATURE_GLOBAL) && feature->max_value == 1)
bits_needed = 0;
else
- bits_needed = min(8, dwrite_log2i(feature->max_value));
+ BitScanReverse(&bits_needed, min(feature->max_value, 256));
if (!feature->max_value || next_bit + bits_needed > 8 * sizeof (feature->mask))
continue;
More information about the wine-cvs
mailing list