From 463636d326e21038dcab8f2df9f46c7d6a847603 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 1 Sep 2008 18:06:28 +0000 Subject: * tool/transcode-tblgen.rb: record infos and BYTE_LOOKUPs as index of word_array to avoid relocation. * transcode.c (transcode_restartable0): add word_array to get infos and BYTE_LOOKUPs. * transcode_data.h (BYTE_LOOKUP_INFO): change return type to uintptr_t. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index bc1597e5b..add97c969 100644 --- a/transcode.c +++ b/transcode.c @@ -480,7 +480,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos, while (1) { inchar_start = in_p; tc->recognized_len = 0; - next_table = tr->conv_tree_start; + next_table = ((uintptr_t)tr->word_array) + tr->conv_tree_start; SUSPEND_OUTPUT_FOLLOWED_BY_INPUT(24); @@ -498,7 +498,8 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos, next_info = INVALID; else { unsigned int next_offset = BL_BASE(next_table)[2+next_byte-BL_BASE(next_table)[0]]; - next_info = (VALUE)BYTE_LOOKUP_INFO(next_table)[next_offset]; +#define BL_INFO(next_table) ((const struct byte_lookup *const *)(((uintptr_t)tr->word_array) + BYTE_LOOKUP_INFO(next_table))) + next_info = (VALUE)BL_INFO(next_table)[next_offset]; } follow_info: switch (next_info & 0x1F) { @@ -514,7 +515,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos, SUSPEND(econv_source_buffer_empty, 5); } next_byte = (unsigned char)*in_p++; - next_table = next_info; + next_table = ((uintptr_t)tr->word_array) + next_info; goto follow_byte; case ZERObt: /* drop input */ continue; -- cgit