shithub: freetype+ttf2subf

Download patch

ref: 149f5438c4698d4142d1135abd472618350fda9d
parent: 9b00875093d1d646798a59d8f5793575fee93adf
author: Werner Lemberg <[email protected]>
date: Mon Apr 18 11:09:38 EDT 2011

Synchronize config files.

* builds/unix/ftconfig.in: Copy missing assembler routines from
include/freetype/config/ftconfig.h.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-18  Werner Lemberg  <[email protected]>
+
+	Synchronize config files.
+
+	* builds/unix/ftconfig.in: Copy missing assembler routines from
+	include/freetype/config/ftconfig.h.
+
 2011-04-13  Werner Lemberg  <[email protected]>
 
 	Fix Savannah bug #33047.
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    UNIX-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
+/*  Copyright 1996-2004, 2006-2009, 2011 by                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -286,11 +286,42 @@
   /* Provide assembler fragments for performance-critical functions. */
   /* These must be defined `static __inline__' with GCC.             */
 
+#if defined( __CC_ARM ) || defined( __ARMCC__ )  /* RVCT */
+#define FT_MULFIX_ASSEMBLER  FT_MulFix_arm
+
+  /* documentation is in freetype.h */
+
+  static __inline FT_Int32
+  FT_MulFix_arm( FT_Int32  a,
+                 FT_Int32  b )
+  {
+    register FT_Int32  t, t2;
+
+
+    __asm
+    {
+      smull t2, t,  b,  a           /* (lo=t2,hi=t) = a*b */
+      mov   a,  t,  asr #31         /* a   = (hi >> 31) */
+      add   a,  a,  #0x8000         /* a  += 0x8000 */
+      adds  t2, t2, a               /* t2 += a */
+      adc   t,  t,  #0              /* t  += carry */
+      mov   a,  t2, lsr #16         /* a   = t2 >> 16 */
+      orr   a,  a,  t,  lsl #16     /* a  |= t << 16 */
+    }
+    return a;
+  }
+
+#endif /* __CC_ARM || __ARMCC__ */
+
+
 #ifdef __GNUC__
 
-#if defined( __arm__ ) && !defined( __thumb__ )
+#if defined( __arm__ ) && !defined( __thumb__ )    && \
+    !( defined( __CC_ARM ) || defined( __ARMCC__ ) )
 #define FT_MULFIX_ASSEMBLER  FT_MulFix_arm
 
+  /* documentation is in freetype.h */
+
   static __inline__ FT_Int32
   FT_MulFix_arm( FT_Int32  a,
                  FT_Int32  b )
@@ -311,11 +342,13 @@
     return a;
   }
 
-#endif /* __arm__ && !__thumb__ */
+#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
 
 #if defined( __i386__ )
 #define FT_MULFIX_ASSEMBLER  FT_MulFix_i386
 
+  /* documentation is in freetype.h */
+
   static __inline__ FT_Int32
   FT_MulFix_i386( FT_Int32  a,
                   FT_Int32  b )
@@ -333,9 +366,9 @@
       "shrl  $16, %%eax\n"
       "shll  $16, %%edx\n"
       "addl  %%edx, %%eax\n"
-      : "=a"(result), "+d"(b)
-      : "a"(a)
-      : "%ecx" );
+      : "=a"(result), "=d"(b)
+      : "a"(a), "d"(b)
+      : "%ecx", "cc" );
     return result;
   }
 
@@ -342,6 +375,43 @@
 #endif /* i386 */
 
 #endif /* __GNUC__ */
+
+
+#ifdef _MSC_VER /* Visual C++ */
+
+#ifdef _M_IX86
+
+#define FT_MULFIX_ASSEMBLER  FT_MulFix_i386
+
+  /* documentation is in freetype.h */
+
+  static __inline FT_Int32
+  FT_MulFix_i386( FT_Int32  a,
+                  FT_Int32  b )
+  {
+    register FT_Int32  result;
+
+    __asm
+    {
+      mov eax, a
+      mov edx, b
+      imul edx
+      mov ecx, edx
+      sar ecx, 31
+      add ecx, 8000h
+      add eax, ecx
+      adc edx, 0
+      shr eax, 16
+      shl edx, 16
+      add eax, edx
+      mov result, eax
+    }
+    return result;
+  }
+
+#endif /* _M_IX86 */
+
+#endif /* _MSC_VER */
 
 #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */