shithub: freetype+ttf2subf

Download patch

ref: 188c7d6670fc69d01495ba791bd3d5c7d10c6824
parent: 05089e8a07dd18544032f7c0bb7179e7315ecbab
author: Alexei Podtelezhnikov <[email protected]>
date: Tue Nov 9 17:47:26 EST 2021

Additional `FT_MSB` macro definitions.

Better macros for Windoes CE and ARM in general, based on !109
from metarutaiga.

* include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -372,11 +372,25 @@
 
 #endif
 
-#elif defined( _MSC_VER ) && ( _MSC_VER >= 1400 )
+#elif defined( _MSC_VER ) && _MSC_VER >= 1400
 
-#if FT_SIZEOF_INT == 4
+#if defined( _WIN32_WCE )
 
+#include <cmnintrin.h>
+#pragma intrinsic( _CountLeadingZeros )
+
+#define FT_MSB( x )  ( 31 - _CountLeadingZeros( x ) )
+
+#elif defined( _M_ARM64 ) || defined( _M_ARM )
+
 #include <intrin.h>
+#pragma intrinsic( _CountLeadingZeros )
+
+#define FT_MSB( x )  ( 31 - _CountLeadingZeros( x ) )
+
+#elif defined( _M_IX86 ) || defined( _M_AMD64 ) || defined( _M_IA64 )
+
+#include <intrin.h>
 #pragma intrinsic( _BitScanReverse )
 
   static __inline FT_Int32
@@ -390,7 +404,7 @@
     return (FT_Int32)where;
   }
 
-#define FT_MSB( x )  ( FT_MSB_i386( x ) )
+#define FT_MSB( x )  FT_MSB_i386( x )
 
 #endif