コード例 #1
0
ファイル: idris_gmp.c プロジェクト: Refefer/Idris-dev
VAL bigMod(VM* vm, VAL x, VAL y) {
    mpz_t* bigint;
    VAL cl = allocate(vm, sizeof(Closure) + sizeof(mpz_t), 0);
    bigint = (mpz_t*)(((char*)cl) + sizeof(Closure));
    mpz_mod(*bigint, GETMPZ(GETBIG(vm,x)), GETMPZ(GETBIG(vm,y)));
    SETTY(cl, BIGINT);
    cl -> info.ptr = (void*)bigint;
    return cl;
}
コード例 #2
0
ファイル: idris_gmp.c プロジェクト: dagit/Idris-dev
VAL bigDiv(VM* vm, VAL x, VAL y) {
    mpz_t* bigint;
    VAL cl = allocate(vm, sizeof(ClosureType) + sizeof(void*));
    bigint = allocate(vm, sizeof(mpz_t));
    mpz_div(*bigint, GETMPZ(x), GETMPZ(y));
    cl -> ty = BIGINT;
    cl -> info.ptr = (void*)bigint;
    return cl;
}
コード例 #3
0
ファイル: idris_gmp.c プロジェクト: erkin/Idris-dev
VAL bigMul(VM* vm, VAL x, VAL y) {
    mpz_t* bigint;
    VAL cl = allocate(vm, sizeof(ClosureType) + sizeof(void*) + 
                          sizeof(mpz_t), 0);
    bigint = (mpz_t*)(((char*)cl) + sizeof(ClosureType) + sizeof(void*));
    mpz_mul(*bigint, GETMPZ(x), GETMPZ(y));
    SETTY(cl, BIGINT);
    cl -> info.ptr = (void*)bigint;
    return cl;
}
コード例 #4
0
ファイル: idris_gmp.c プロジェクト: jstolarek/Idris-dev
VAL bigDiv(VM* vm, VAL x, VAL y) {
    idris_requireAlloc(IDRIS_MAXGMP);

    mpz_t* bigint;
    VAL cl = allocate(sizeof(Closure) + sizeof(mpz_t), 0);
    bigint = (mpz_t*)(((char*)cl) + sizeof(Closure));
    mpz_tdiv_q(*bigint, GETMPZ(GETBIG(vm,x)), GETMPZ(GETBIG(vm,y)));
    SETTY(cl, BIGINT);
    cl -> info.ptr = (void*)bigint;
    return cl;
}
コード例 #5
0
ファイル: idris_gmp.c プロジェクト: adamsmd/Idris-dev
VAL bigAShiftRight(VM* vm, VAL x, VAL y) {
    idris_requireAlloc(IDRIS_MAXGMP);

    mpz_t* bigint;
    VAL cl = allocate(sizeof(Closure) + sizeof(mpz_t), 0);
    idris_doneAlloc();
    bigint = (mpz_t*)(((char*)cl) + sizeof(Closure));
    mpz_fdiv_q_2exp(*bigint, GETMPZ(GETBIG(vm,x)), GETINT(y));
    SETTY(cl, CT_BIGINT);
    cl -> info.ptr = (void*)bigint;
    return cl;
}