[Anthy-dev 1978] anthy : wtype_tについて

Back to archive index

Kazuki Ohta mover****@hct*****
2005年 3月 21日 (月) 02:57:17 JST


anthyをCodeReadingしていて気づいたのですが、include/wtype.hで定義されている
struct wtype(wtype_t)のpad エントリが使われていないようなので報告しておきま
す。

--- anthy-6300d-orig/include/wtype.h    2005-02-09 22:24:19.000000000 +0900
+++ anthy-6300d/include/wtype.h 2005-03-21 02:29:20.000000000 +0900
@@ -168,7 +168,6 @@
 
 /** 品詞 **/
 struct wtype{
-  unsigned short pad;
   unsigned char type[6];
 };

この構造体については結構メモリを余分に使用しているので、以下の様に変
更しては如何でしょうか?

#define POS_BITS  4
#define COS_BITS  3
#define SCOS_BITS 5
#define CC_BITS   5
#define CT_BITS   4
#define WF_BITS   3

struct wtype {
  unsigned int pos  : POS_BITS;
  unsigned int cos  : COS_BITS;
  unsigned int scos : SCOS_BITS;
  unsigned int cc   : CC_BITS;
  unsigned int ct   : CT_BITS;
  unsigned int wf   : WF_BIts;
};

こうすると大体24bit分 + ポインタ分(32bit)ぐらいメモリを削減できると
思います。

どうでしょう? > 吉田さん、田畑さん


Anthy-dev メーリングリストの案内
Back to archive index