
#include "fxttypes.h"


void
mixedradix_init(ulong n, ulong mm, const ulong *m, ulong *m1)
// Auxiliary function used to initialize vector of nines in mixed radix classes.
{
    if ( m )  // all radices given
    {
        for (ulong k=0; k<n; ++k)  m1[k] = m[k] - 1;
    }
    else
    {
        if ( mm>1 )  // use mm as radix for all digits:
            for (ulong k=0; k<n; ++k)  m1[k] = mm - 1;
        else
        {
            if ( mm==0 )  // falling factorial basis
                for (ulong k=0; k<n; ++k)  m1[k] = n - k;
            else // rising factorial basis
                for (ulong k=0; k<n; ++k)  m1[k] = k + 1;
        }
    }
}
// -------------------------

