scala use of GMPUtil for pidigits
Rex Kerr has posted info about using GMP with scala, in particular to run the pidigits program. libjpargmp.so is generated using G开发者_运维百科mpUtil.c
My question is: where do I find GMPUtil.c? My google searches haven't turned up anything.
Regards, Doug
Posting on the Alioth computer languages benchmark game forum would more likely yield an answer than posting here. However, in this case you've gotten lucky (though I don't know if this is exactly an appropriate use of StackOverflow).
GmpUtil.h:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class GmpUtil */
#ifndef _Included_GmpUtil
#define _Included_GmpUtil
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: GmpUtil
* Method: mpz_init
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_GmpUtil_mpz_1init
(JNIEnv *, jclass);
/*
* Class: GmpUtil
* Method: mpz_clear
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1clear
(JNIEnv *, jclass, jlong);
/*
* Class: GmpUtil
* Method: mpz_set_si
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1set_1si
(JNIEnv *, jclass, jlong, jint);
/*
* Class: GmpUtil
* Method: mpz_get_si
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_GmpUtil_mpz_1get_1si
(JNIEnv *, jclass, jlong);
/*
* Class: GmpUtil
* Method: mpz_cmp
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_GmpUtil_mpz_1cmp
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: GmpUtil
* Method: mpz_add
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1add
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: GmpUtil
* Method: mpz_sub
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1sub
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: GmpUtil
* Method: mpz_mul_si
* Signature: (JJI)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1mul_1si
(JNIEnv *, jclass, jlong, jlong, jint);
/*
* Class: GmpUtil
* Method: mpz_divexact
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1divexact
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: GmpUtil
* Method: mpz_tdiv_qr
* Signature: (JJJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1tdiv_1qr
(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
/*
* Class: GmpUtil
* Method: mpz_gcd
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1gcd
(JNIEnv *, jclass, jlong, jlong, jlong);
#ifdef __cplusplus
}
#endif
#endif
GmpUtil.c:
#include "GmpUtil.h"
#include "gmp.h"
/*
* Class: GmpUtil
* Method: mpz_init
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_GmpUtil_mpz_1init
(JNIEnv *x, jclass y)
{
mpz_t *p = malloc( sizeof(__mpz_struct) );
__gmpz_init( *p );
return (jlong)p;
}
/*
* Class: GmpUtil
* Method: mpz_clear
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1clear
(JNIEnv *x, jclass y, jlong o)
{
mpz_t* p = (mpz_t*)o;
__gmpz_clear( *p );
free( p );
}
/*
* Class: GmpUtil
* Method: mpz_set_si
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1set_1si
(JNIEnv *x, jclass y, jlong dest, jint val)
{
__gmpz_set_si( *((mpz_t*)dest), (long) val);
}
/*
* Class: GmpUtil
* Method: mpz_get_si
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_GmpUtil_mpz_1get_1si
(JNIEnv *x, jclass y, jlong dest)
{
return (jint)__gmpz_get_si( *((mpz_t*)dest));
}
/*
* Class: GmpUtil
* Method: mpz_cmp
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_GmpUtil_mpz_1cmp
(JNIEnv *x, jclass y, jlong op1, jlong op2)
{
return (jint) __gmpz_cmp( *((mpz_t*)op1), *((mpz_t*)op2) );
}
/*
* Class: GmpUtil
* Method: mpz_add
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1add
(JNIEnv *x, jclass y, jlong dest, jlong src, jlong val)
{
__gmpz_add( *((mpz_t*)dest), *((mpz_t*)src), *((mpz_t*)val) );
}
/*
* Class: GmpUtil
* Method: mpz_sub
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1sub
(JNIEnv *x, jclass y, jlong dest, jlong src, jlong val)
{
__gmpz_sub( *((mpz_t*)dest), *((mpz_t*)src), *((mpz_t*)val) );
}
/*
* Class: GmpUtil
* Method: mpz_mul_si
* Signature: (JJI)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1mul_1si
(JNIEnv *x, jclass y, jlong dest, jlong src, jint val)
{
__gmpz_mul_si( *((mpz_t*)dest), *((mpz_t*)src), (long) val);
}
/*
* Class: GmpUtil
* Method: mpz_divexact
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1divexact
(JNIEnv *x, jclass y, jlong quot, jlong n, jlong d)
{
__gmpz_divexact( *((mpz_t*)quot), *((mpz_t*)n), *((mpz_t*)d));
}
/*
* Class: GmpUtil
* Method: mpz_tdiv_qr
* Signature: (JJJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1tdiv_1qr
(JNIEnv *x, jclass y, jlong q, jlong r, jlong n, jlong d)
{
__gmpz_tdiv_qr( *((mpz_t*)q), *((mpz_t*)r), *((mpz_t*)n), *((mpz_t*)d) );
}
/*
* Class: GmpUtil
* Method: mpz_gcd
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_GmpUtil_mpz_1gcd
(JNIEnv *x, jclass y, jlong r, jlong a, jlong b)
{
__gmpz_gcd( *((mpz_t*)r), *((mpz_t*)a), *((mpz_t*)b) );
}
精彩评论