Commit d4cbbf35d44c96641be5b614181d058c51623500

Werner Lemberg 2012-07-03T11:01:53

[autofit] Minor speed-up. * src/autofit/afangles (af_sort_pos, af_sort_widths): Don't swap elements if they are equal.

diff --git a/ChangeLog b/ChangeLog
index c7cadad..0e06873 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-07-03  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] Minor speed-up.
+
+	* src/autofit/afangles (af_sort_pos, af_sort_widths): Don't swap
+	elements if they are equal.
+
 2012-06-30  Gilles Espinasse  <g.esp@free.fr>
 
 	Fix `checking if gcc static flag -static works' test.
diff --git a/src/autofit/afangles.c b/src/autofit/afangles.c
index 790af17..653d3f6 100644
--- a/src/autofit/afangles.c
+++ b/src/autofit/afangles.c
@@ -5,7 +5,7 @@
 /*    Routines used to compute vector angles with limited accuracy         */
 /*    and very high speed.  It also contains sorting routines (body).      */
 /*                                                                         */
-/*  Copyright 2003-2006, 2011 by                                           */
+/*  Copyright 2003-2006, 2011-2012 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -255,7 +255,7 @@
     {
       for ( j = i; j > 0; j-- )
       {
-        if ( table[j] > table[j - 1] )
+        if ( table[j] >= table[j - 1] )
           break;
 
         swap         = table[j];
@@ -278,7 +278,7 @@
     {
       for ( j = i; j > 0; j-- )
       {
-        if ( table[j].org > table[j - 1].org )
+        if ( table[j].org >= table[j - 1].org )
           break;
 
         swap         = table[j];