From: Paul Eggert Date: Sat, 9 Apr 2011 22:21:42 +0000 (-0700) Subject: * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~356^2~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9248994de4e597941230d9cb07a50df994c7825b;p=emacs.git * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise. --- diff --git a/src/ChangeLog b/src/ChangeLog index 1e2d4fd00af..9029fff9820 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-04-09 Paul Eggert * charset.c (load_charset_map): <, not <=, for optimization. + * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise. * xmenu.c (set_frame_menubar): Allocate smaller local vectors. This also lets GCC 4.6.0 generate slightly better loop code. diff --git a/src/chartab.c b/src/chartab.c index 9ad182131e9..450948a9b37 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -392,7 +392,8 @@ sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, *table = val; else { - int i, j; + int i; + unsigned j; depth++; if (! SUB_CHAR_TABLE_P (*table)) @@ -403,8 +404,9 @@ sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, to = max_char; i = CHARTAB_IDX (from, depth, min_char); j = CHARTAB_IDX (to, depth, min_char); + j++; min_char += chartab_chars[depth] * i; - for (; i <= j; i++, min_char += chartab_chars[depth]) + for (; i < j; i++, min_char += chartab_chars[depth]) sub_char_table_set_range (XSUB_CHAR_TABLE (*table)->contents + i, depth, min_char, from, to, val); } @@ -416,16 +418,16 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); Lisp_Object *contents = tbl->contents; - int i, min_char; + int i; if (from == to) char_table_set (table, from, val); else { - for (i = CHARTAB_IDX (from, 0, 0), min_char = i * chartab_chars[0]; - min_char <= to; - i++, min_char += chartab_chars[0]) - sub_char_table_set_range (contents + i, 0, min_char, from, to, val); + unsigned lim = to / chartab_chars[0] + 1; + for (i = CHARTAB_IDX (from, 0, 0); i < lim; i++) + sub_char_table_set_range (contents + i, 0, i * chartab_chars[0], + from, to, val); if (ASCII_CHAR_P (from)) tbl->ascii = char_table_ascii (table); }