[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 84eebf4: Use MS VC++'s _BitScanReverse to calculate M
From: |
Werner LEMBERG |
Subject: |
[freetype2] master 84eebf4: Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636). |
Date: |
Sat, 12 May 2018 00:18:51 -0400 (EDT) |
branch: master
commit 84eebf48021ab76c1c628bb7451b712f701e4518
Author: Arkady Shapkin <address@hidden>
Commit: Werner Lemberg <address@hidden>
Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636).
* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Implement
it.
---
ChangeLog | 7 +++++++
include/freetype/internal/ftcalc.h | 26 +++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 004c96f..4bd8e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-12 Arkady Shapkin <address@hidden>
+
+ Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636).
+
+ * include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Implement
+ it.
+
2018-05-10 Alan Coopersmith <address@hidden>
Fix DLL compilation on Solaris.
diff --git a/include/freetype/internal/ftcalc.h
b/include/freetype/internal/ftcalc.h
index 818a812..3f889e6 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -341,6 +341,7 @@ FT_BEGIN_HEADER
*/
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
+
#if defined( __GNUC__ ) && \
( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )
@@ -354,7 +355,30 @@ FT_BEGIN_HEADER
#endif
-#endif /* __GNUC__ */
+
+#elif defined( _MSC_VER )
+
+#if FT_SIZEOF_INT == 4
+
+#include <intrin.h>
+
+ static inline FT_Int32
+ FT_MSB_i386( FT_UInt32 x )
+ {
+ unsigned long where;
+
+
+ _BitScanReverse( &where, x );
+
+ return (FT_Int32)where;
+ }
+
+#define FT_MSB( x ) ( FT_MSB_i386( x ) )
+
+#endif
+
+#endif
+
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
#ifndef FT_MSB
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 84eebf4: Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636).,
Werner LEMBERG <=