changeset 88429:89eaf88b37b4

(sub_char_table_set_range): Optimized for the case DEPTH == 3. Add workaround code for a GCC optimization bug.
author Kenichi Handa <handa@m17n.org>
date Tue, 05 Mar 2002 00:08:31 +0000
parents 5eaa8c11ab45
children 6418a272b97e
files src/chartab.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/chartab.c	Tue Mar 05 00:08:10 2002 +0000
+++ b/src/chartab.c	Tue Mar 05 00:08:31 2002 +0000
@@ -377,7 +377,7 @@
 {
   int max_char = min_char + chartab_chars[depth] - 1;
 
-  if (from <= min_char && to >= max_char)
+  if (depth == 3 || from <= min_char && to >= max_char)
     *table = val;
   else
     {
@@ -390,12 +390,12 @@
 	from = min_char;
       if (to > max_char)
 	to = max_char;
+      i = CHARTAB_IDX (from, depth, min_char);
       j = CHARTAB_IDX (to, depth, min_char);
-      for (i = CHARTAB_IDX (from, depth, min_char); i <= j; i++)
+      min_char += chartab_chars[depth] * i;
+      for (; i <= j; i++, min_char += chartab_chars[depth])
 	sub_char_table_set_range (XSUB_CHAR_TABLE (*table)->contents + i,
-				  depth,
-				  min_char + chartab_chars[depth] * i,
-				  from, to, val);
+				  depth, min_char, from, to, val);
     }
 }