/*
  gestion de grands nombres - juil 97 - Sylvain Huet
   definitions
*/

#ifndef __BIGNUM_H__
#define __BIGNUM_H__


#include "base.h"
#define SIZEV 8


#if defined (OPTI_P3) || defined(OPTI_P4)

typedef struct __declspec(intrin_type) __declspec(align(16)) __my128i 
{
    uint64 m128i_u64[2];
} __my128i;

#endif

int32 CRfromAsc(char *buf,int16 *v);
char *CRtoAsc(char *buf,int16 *v);
int32 CRfromDec(char *buf,int16 *v);
int32 CRtoDec(int16 *u,char *dst);

int32 CRfromString(char *buf,int16 *v,int32 n);
char *CRtoString(char *buf,int16 *v,int32 *n);
char *CRtoStringn(char *buf,int16 *v,int32 n);

int32 CRfromInt(int32 x,int16 *v);
int32 CRtoInt(int16 *v);

int32 CRcopy(int16 *p, int16 *r) ;

int32 CRnul(int16 *r);
int32 CRrand(int16 *r);

int32 CRxor(int16 *p, int16 *q, int16 *r);
int32 CRadd(int16 *p, int16 *q, int16 *r);
int32 CRsub(int16 *p, int16 *q, int16 *r);
int32 CRneg(int16 *p,int16 *r);
int32 CRshl(int16 *p, int16 *r);
int32 CRshr(int16 *p, int16 *r);
int32 CRsar(int16 *p, int16 *r);

int32 CRgu(uint16 *p,uint16 *q);
int32 CRcmp(uint16 *p,uint16 *q);
int32 CRg(int16 *p,int16 *q);
int32 CRl(int16 *p,int16 *q);
int32 CRe(int16 *p,int16 *q);
int32 CRnotnull(int16 *x);
int32 CRpositif(int16 *v);
int32 CRisone(int16 *v);
int32 CRisminusone(int16 *v);
int32 CRestpair(int16 *x);

int32 CRmodn(int16 *p, int16 *q, int16 *r);
int32 CRdiv(int16 *p, int16 *q, int16 *r);
int32 CRmul(int16 *p, int16 *q, int16 *res);
int32 CRmuln(int16 *p, int16 *q, int16 *n, int16 *res);
int32 CRpgcd(int16 *p, int16 *q, int16 *r);
int32 CRexpn(int16 *p, int16 *e, int16 *n, int16 *res);
int32 CRinv(int16 *p, int16 *q, int16 *r);
int32 CRfindPrimal(int16 *u,int32 i0);
int32 CRtime(int16 *r);



#endif