summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2010-06-30 10:26:48 +0200
committerWerner Lemberg <wl@gnu.org>2010-06-30 10:26:48 +0200
commit0ae6cf214ff1eec6499c347726a18b8a9809ab2c (patch)
tree6b4d81fb63f9c1364733f56c486627698998453b
parentae425e518975835ef81620d566b9dc84bf73cc36 (diff)
downloadfreetype2-0ae6cf214ff1eec6499c347726a18b8a9809ab2c.tar.gz
Minor optimizations by avoiding divisions.
* src/sfnt/ttkern.c (tt_face_load_kern, tt_face_get_kerning): Replace divisions with multiplication in comparisons.
-rw-r--r--ChangeLog7
-rw-r--r--src/sfnt/ttkern.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4dbb306b3..948c563fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-30 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ Minor optimizations by avoiding divisions.
+
+ * src/sfnt/ttkern.c (tt_face_load_kern, tt_face_get_kerning):
+ Replace divisions with multiplication in comparisons.
+
2010-06-29 Werner Lemberg <wl@gnu.org>
Fix minor tracing issues.
diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
index c1540802b..46888988e 100644
--- a/src/sfnt/ttkern.c
+++ b/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType kerning table. This doesn't handle */
/* kerning data within the GPOS table at the moment. */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -115,7 +115,7 @@
num_pairs = FT_NEXT_USHORT( p );
p += 6;
- if ( ( p_next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ if ( ( p_next - p ) < 6 * (int)num_pairs ) /* handle broken count */
num_pairs = (FT_UInt)( ( p_next - p ) / 6 );
avail |= mask;
@@ -220,7 +220,7 @@
num_pairs = FT_NEXT_USHORT( p );
p += 6;
- if ( ( next - p ) / 6 < (int)num_pairs ) /* handle broken count */
+ if ( ( next - p ) < 6 * (int)num_pairs ) /* handle broken count */
num_pairs = (FT_UInt)( ( next - p ) / 6 );
switch ( coverage >> 8 )