예제 #1
0
파일: gf256.cpp 프로젝트: catid/wh256
extern "C" int gf256_init_(int version)
{
    if (version != GF256_VERSION)
    {
        // User's header does not match library version.
        return -1;
    }

    // Avoid multiple initialization
    if (Initialized)
    {
        return 0;
    }
    Initialized = true;

    if (!IsLittleEndian())
    {
        // Architecture is not supported (code won't work without mods).
        return -2;
    }

    gf255_poly_init(DefaultPolynomialIndex);
    gf256_explog_init();
    gf256_muldiv_init();
    gf256_inv_init();
    gf256_muladd_mem_init();

    return 0;
}
예제 #2
0
파일: gf256.cpp 프로젝트: f4exb/cm256cc
int gf256_ctx::gf256_init_()
{
    // Avoid multiple initialization
    if (initialized)
    {
        return 0;
    }

    if (!IsLittleEndian())
    {
        fprintf(stderr, "gf256_ctx::gf256_init_: Little Endian architecture expected (code won't work without mods)\n");
        return -2;
    }

    gf255_poly_init(DefaultPolynomialIndex);
    gf256_explog_init();
    gf256_muldiv_init();
    gf256_inv_init();
    gf256_muladd_mem_init();

    initialized = true;
    fprintf(stderr, "gf256_ctx::gf256_init_: initialized\n");
    return 0;
}