@@ -54,13 +54,11 @@ extern "C" {
5454#endif
5555
5656/*
57- * Compile-time constant determining the size of the
58- * bitvector fsg_pnode_t.fsg_pnode_ctxt_t.bv. (See below.)
59- * But it makes memory allocation simpler and more efficient.
60- * Make it smaller (2) to save memory if your phoneset has less than
61- * 64 phones.
57+ * Size of the bitvector fsg_pnode_t.fsg_pnode_ctxt_t.bv.
58+ * Each uint32 provides 32 bits, so BVSZ * 32 = max number of phones.
59+ * BVSZ=8 supports up to 256 phones, which covers all known phonesets.
6260 */
63- #define FSG_PNODE_CTXT_BVSZ 4
61+ #define FSG_PNODE_CTXT_BVSZ 8
6462
6563typedef struct fsg_pnode_ctxt_s {
6664 uint32 bv [FSG_PNODE_CTXT_BVSZ ];
@@ -153,31 +151,12 @@ typedef struct fsg_pnode_s {
153151
154152#define fsg_pnode_add_ctxt (p ,c ) ((p)->ctxt.bv[(c)>>5] |= (1 << ((c)&0x001f)))
155153
156- /*
157- * The following is macroized because its called very frequently
158- * ::: uint32 fsg_pnode_ctxt_sub (fsg_pnode_ctxt_t *src, fsg_pnode_ctxt_t *sub);
159- */
160154/*
161155 * Subtract bitvector sub from bitvector src (src updated with the result).
162156 * Return 0 if result is all 0, non-zero otherwise.
157+ * Uses generic implementation to support arbitrary BVSZ values.
163158 */
164-
165- #if (FSG_PNODE_CTXT_BVSZ == 1 )
166- #define FSG_PNODE_CTXT_SUB (src ,sub ) \
167- ((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0]))
168- #elif (FSG_PNODE_CTXT_BVSZ == 2 )
169- #define FSG_PNODE_CTXT_SUB (src ,sub ) \
170- (((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0])) | \
171- ((src)->bv[1] = (~((sub)->bv[1]) & (src)->bv[1])))
172- #elif (FSG_PNODE_CTXT_BVSZ == 4 )
173- #define FSG_PNODE_CTXT_SUB (src ,sub ) \
174- (((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0])) | \
175- ((src)->bv[1] = (~((sub)->bv[1]) & (src)->bv[1])) | \
176- ((src)->bv[2] = (~((sub)->bv[2]) & (src)->bv[2])) | \
177- ((src)->bv[3] = (~((sub)->bv[3]) & (src)->bv[3])))
178- #else
179- #define FSG_PNODE_CTXT_SUB (src ,sub ) fsg_pnode_ctxt_sub_generic((src),(sub))
180- #endif
159+ #define FSG_PNODE_CTXT_SUB (src ,sub ) fsg_pnode_ctxt_sub_generic((src),(sub))
181160
182161/**
183162 * Collection of lextrees for an FSG.
0 commit comments