2015-05-22 9:55 GMT+02:00 Daiki Ueno <u...@gnu.org>: > Michele Locati <mich...@locati.it> writes: > > [...] > Yes, my intent was to make the output resemble the current style of > plural-table.c as much as possible, to make the initial diff smaller. > [...] > BTW, for samples, I plan to add a separate array, say > plural_sample_table to avoid confusion. >
It's a good compromise ;) [...] > I hit on an algorithm: > > - From all rules, find the largest modulo M (here 100) > > - Prepare a bit vector with M elements and initialize it with zeros > > - Loop over the rules > - For each value in the range [1, M], apply a rule, and flip the > corresponding bit if it evaluates true > - Stop if all bits are set > > Maybe we can also omit rules which don't change the vector, but it seems > to work with the Russian case so far: > > http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/src/cldr-plural-exp.c?h=wip/ueno/cldr-plural#n546 > I started from the assumption that languages won't change that much, but your approach is a much better solution IMHO. Did you tested if for the other special case (pl - Polish) too? Ciao -- Michele