2011-04-09 Paul Eggert <eggert@cs.ucla.edu>
* 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.
*table = val;
else
{
- int i, j;
+ int i;
+ unsigned j;
depth++;
if (! SUB_CHAR_TABLE_P (*table))
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);
}
{
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);
}