ruby-changes:7572
From: akr <ko1@a...>
Date: Wed, 3 Sep 2008 21:35:55 +0900 (JST)
Subject: [ruby-changes:7572] Ruby:r19093 (trunk): * transcode_data.h (WORDINDEX_SHIFT_BITS): defined.
akr 2008-09-03 21:35:29 +0900 (Wed, 03 Sep 2008) New Revision: 19093 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19093 Log: * transcode_data.h (WORDINDEX_SHIFT_BITS): defined. (WORDINDEX2INFO): defined. (INFO2WORDINDEX): defined. * tool/transcode-tblgen.rb: use WORDINDEX2INFO. * transcode.c: use INFO2WORDINDEX. Modified files: trunk/ChangeLog trunk/tool/transcode-tblgen.rb trunk/transcode.c trunk/transcode_data.h Index: ChangeLog =================================================================== --- ChangeLog (revision 19092) +++ ChangeLog (revision 19093) @@ -1,3 +1,13 @@ +Wed Sep 3 21:31:59 2008 Tanaka Akira <akr@f...> + + * transcode_data.h (WORDINDEX_SHIFT_BITS): defined. + (WORDINDEX2INFO): defined. + (INFO2WORDINDEX): defined. + + * tool/transcode-tblgen.rb: use WORDINDEX2INFO. + + * transcode.c: use INFO2WORDINDEX. + Wed Sep 3 21:19:51 2008 Kazuhiro NISHIYAMA <zn@m...> * golf_prelude.rb: suppress warning when goruby -v. Index: transcode_data.h =================================================================== --- transcode_data.h (revision 19092) +++ transcode_data.h (revision 19093) @@ -14,6 +14,9 @@ #ifndef RUBY_TRANSCODE_DATA_H #define RUBY_TRANSCODE_DATA_H 1 +#define WORDINDEX_SHIFT_BITS 2 +#define WORDINDEX2INFO(widx) ((widx) << WORDINDEX_SHIFT_BITS) +#define INFO2WORDINDEX(info) ((info) >> WORDINDEX_SHIFT_BITS) #define BYTE_LOOKUP_BASE(bl) ((bl)[0]) #define BYTE_LOOKUP_INFO(bl) ((bl)[1]) Index: tool/transcode-tblgen.rb =================================================================== --- tool/transcode-tblgen.rb (revision 19092) +++ tool/transcode-tblgen.rb (revision 19093) @@ -365,13 +365,13 @@ size = words_code.length words_code.insert_at_last(infos.length, - "\#define #{infos_name} (sizeof(unsigned int)*#{size})\n" + + "\#define #{infos_name} WORDINDEX2INFO(#{size})\n" + format_infos(infos) + "\n") end size = words_code.length words_code.insert_at_last(NUM_ELEM_BYTELOOKUP, - "\#define #{name} (sizeof(unsigned int)*#{size})\n" + + "\#define #{name} WORDINDEX2INFO(#{size})\n" + <<"End" + "\n") #{offsets_name}, #{infos_name}, Index: transcode.c =================================================================== --- transcode.c (revision 19092) +++ transcode.c (revision 19093) @@ -492,7 +492,7 @@ } #define BYTE_ADDR(index) (tr->byte_array + (index)) -#define WORD_ADDR(index) (tr->word_array + (index)/sizeof(*tr->word_array)) +#define WORD_ADDR(index) (tr->word_array + INFO2WORDINDEX(index)) #define BL_BASE(bl) BYTE_ADDR(BYTE_LOOKUP_BASE(WORD_ADDR(bl))) #define BL_INFO(bl) WORD_ADDR(BYTE_LOOKUP_INFO(WORD_ADDR(bl))) #define BL_MIN_BYTE(bl) (BL_BASE(bl)[0]) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/