summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-02 13:26:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-02 13:26:02 +0000
commit41e1933fd8df02d3244aa477f4f5a78d7ff12e65 (patch)
treeae5760281f2cc91f69a443bb5f5c1f85246759d7 /transcode.c
parent39f172f9d73d140e5e8ed914f151e130f0cb883c (diff)
* transcode_data.h (base_element): removed.
(BYTE_LOOKUP): removed. (BYTE_LOOKUP_BASE): don't cast. (BYTE_LOOKUP_INFO): ditto. (PType): unsigned int, instead of uintptr_t. (rb_transcoding): change type of next_field, conv_tree_start and word_array. * tool/transcode-tblgen.rb: generate word_array as array of unsigned int. * transcode.c (transcode_restartable0): follow the above type change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c
index add97c9695..c6c828cbb4 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 = ((uintptr_t)tr->word_array) + tr->conv_tree_start;
+ next_table = tr->conv_tree_start;
SUSPEND_OUTPUT_FOLLOWED_BY_INPUT(24);
@@ -493,12 +493,14 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
next_byte = (unsigned char)*in_p++;
follow_byte:
-#define BL_BASE(next_table) (tr->byte_array + BYTE_LOOKUP_BASE(next_table))
+#define BL_BASE(next_table) \
+ (tr->byte_array + BYTE_LOOKUP_BASE(tr->word_array + next_table/sizeof(*tr->word_array)))
if (next_byte < BL_BASE(next_table)[0] || BL_BASE(next_table)[1] < next_byte)
next_info = INVALID;
else {
unsigned int next_offset = BL_BASE(next_table)[2+next_byte-BL_BASE(next_table)[0]];
-#define BL_INFO(next_table) ((const struct byte_lookup *const *)(((uintptr_t)tr->word_array) + BYTE_LOOKUP_INFO(next_table)))
+#define BL_INFO(next_table) \
+ (tr->word_array + BYTE_LOOKUP_INFO(tr->word_array + next_table/sizeof(*tr->word_array))/sizeof(*tr->word_array))
next_info = (VALUE)BL_INFO(next_table)[next_offset];
}
follow_info:
@@ -515,7 +517,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 = ((uintptr_t)tr->word_array) + next_info;
+ next_table = next_info;
goto follow_byte;
case ZERObt: /* drop input */
continue;