[BACK]Return to cmo-gmp.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / plugin

Diff for /OpenXM/src/kan96xx/plugin/cmo-gmp.c between version 1.6 and 1.11

version 1.6, 2001/05/04 01:06:29 version 1.11, 2020/10/06 11:33:47
Line 1 
Line 1 
 /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo-gmp.c,v 1.5 2000/02/01 02:38:58 noro Exp $ */  /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo-gmp.c,v 1.10 2015/09/14 07:56:20 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
   #include <stdlib.h>
 #include <string.h>  #include <string.h>
 /* #include <netinet/in.h> */  /* #include <netinet/in.h> */
   #include <limits.h>
   #include <arpa/inet.h>
 #include "datatype.h"  #include "datatype.h"
 #include "stackm.h"  #include "stackm.h"
 #include "extern.h"  #include "extern.h"
Line 10 
Line 13 
 #include "kclass.h"  #include "kclass.h"
   
 #include "gmp.h"  #include "gmp.h"
 #include "gmp-impl.h"  #include "gmp-impl.h"
   
   
 #include "file2.h"  #include "file2.h"
 #include "cmo.h"  #include "cmo.h"
   
   /* for gmp6.0.0 */
   #ifndef BYTES_PER_MP_LIMB
   #define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T
   #endif
   
 extern int OxVersion;  extern int OxVersion;
 size_t cmoOutGMPCoeff_old(mpz_srcptr x);  size_t cmoOutGMPCoeff_old(mpz_srcptr x);
 size_t cmoOutGMPCoeff_new(mpz_srcptr x);  size_t cmoOutGMPCoeff_new(mpz_srcptr x);
 size_t  size_t cmoGetGMPCoeff_old(MP_INT *x, struct cmoBuffer *cb);
 cmoOutGMPCoeff(mpz_srcptr x) {  size_t cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb);
   
   size_t cmoOutGMPCoeff(mpz_srcptr x) {
   if (OxVersion >= 199907170)    if (OxVersion >= 199907170)
     return(cmoOutGMPCoeff_new(x));      return(cmoOutGMPCoeff_new(x));
   else    else
     return(cmoOutGMPCoeff_old(x));      return(cmoOutGMPCoeff_old(x));
 }  }
   
 cmoGetGMPCoeff(MP_INT *x, struct cmoBuffer *cb) {  size_t cmoGetGMPCoeff(MP_INT *x, struct cmoBuffer *cb) {
   if (OxVersion >= 199907170)    if (OxVersion >= 199907170)
     return(cmoGetGMPCoeff_new(x,cb));      return(cmoGetGMPCoeff_new(x,cb));
   else    else
Line 64  static int myfputc(int i) {
Line 74  static int myfputc(int i) {
   tmp[0] = i;    tmp[0] = i;
   cmoOutputToBuf(CMOPUT,tmp,1);    cmoOutputToBuf(CMOPUT,tmp,1);
 }  }
 static outRawInt32(int k)  static void outRawInt32(int k)
 {  {
   int tmp[1];    int tmp[1];
   tmp[0] = htonl((int) k);    tmp[0] = htonl((int) k);
   cmoOutputToBuf(CMOPUT,tmp,4);    cmoOutputToBuf(CMOPUT,tmp,4);
 }  }
   
 size_t  size_t cmoOutGMPCoeff_old(mpz_srcptr x)
 cmoOutGMPCoeff_old(mpz_srcptr x)  
 {  {
   fprintf(stderr,"cmoOutGMPCoeff_old is no longer supported.\n");    fprintf(stderr,"cmoOutGMPCoeff_old is no longer supported.\n");
   exit(10);    exit(10);
     return 0;
 }  }
   
   
Line 141  static int getRawInt32(struct cmoBuffer *cb)
Line 151  static int getRawInt32(struct cmoBuffer *cb)
 }  }
 #endif  #endif
   
 cmoGetGMPCoeff_old(MP_INT *x, struct cmoBuffer *cb)  size_t cmoGetGMPCoeff_old(MP_INT *x, struct cmoBuffer *cb)
 {  {
   fprintf(stderr,"cmoGetGMPCoeff_old is no longer supported.\n");    fprintf(stderr,"cmoGetGMPCoeff_old is no longer supported.\n");
   exit(10);    exit(10);
     return 0;
 }  }
   
 /*****************************************************/  /*****************************************************/
 /*****   new version for CMO_ZZ  *********************/  /*****   new version for CMO_ZZ  *********************/
 /*****************************************************/  /*****************************************************/
 #if BYTES_PER_MP_LIMB == 8  #if BYTES_PER_MP_LIMB == 8
 size_t  size_t cmoOutGMPCoeff_new(mpz_srcptr x)
 cmoOutGMPCoeff_new(mpz_srcptr x)  
 {  {
   int i;    int i;
   mp_size_t s;    mp_size_t s;
Line 166  cmoOutGMPCoeff_new(mpz_srcptr x)
Line 176  cmoOutGMPCoeff_new(mpz_srcptr x)
   tmp[0] = htonl(CMO_ZZ);    tmp[0] = htonl(CMO_ZZ);
   cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));    cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
   
   if (BITS_PER_CHAR != 8) {    if (CHAR_BIT != 8) {
     fprintf(stderr,"BITS_PER_CHAR = %d\n",BITS_PER_CHAR);      fprintf(stderr,"CHAR_BIT = %d\n",CHAR_BIT);
     fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");      fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");  
     exit(10);      exit(10);
   }    }
   
Line 203  cmoOutGMPCoeff_new(mpz_srcptr x)
Line 212  cmoOutGMPCoeff_new(mpz_srcptr x)
   return ( ABS (xsize) );    return ( ABS (xsize) );
 }  }
   
 cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)  size_t cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
 {  {
   int i;    int i;
   mp_size_t s;    mp_size_t s;
Line 215  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
Line 224  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
   mp_size_t in_bytesize;    mp_size_t in_bytesize;
   int neg_flag;    int neg_flag;
   
   if (BITS_PER_CHAR != 8) {    if (CHAR_BIT != 8) {
     fprintf(stderr,"BITS_PER_CHAR = %d\n",BITS_PER_CHAR);      fprintf(stderr,"CHAR_BIT = %d\n",CHAR_BIT);
     fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");      fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");  
     exit(10);      exit(10);
   }    }
   
Line 254  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
Line 262  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
   return( xsize0 );    return( xsize0 );
 }  }
 #elif BYTES_PER_MP_LIMB == 4  #elif BYTES_PER_MP_LIMB == 4
 size_t  size_t cmoOutGMPCoeff_new(mpz_srcptr x)
 cmoOutGMPCoeff_new(mpz_srcptr x)  
 {  {
   int i;    int i;
   mp_size_t s;    mp_size_t s;
Line 274  cmoOutGMPCoeff_new(mpz_srcptr x)
Line 281  cmoOutGMPCoeff_new(mpz_srcptr x)
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");      fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");
     exit(10);      exit(10);
   }    }
   if (BITS_PER_CHAR != 8) {    if (CHAR_BIT != 8) {
     fprintf(stderr,"BITS_PER_CHAR = %d\n",BITS_PER_CHAR);      fprintf(stderr,"CHAR_BIT = %d\n",CHAR_BIT);
     fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");      fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");  
     exit(10);      exit(10);
   }    }
   
Line 303  cmoOutGMPCoeff_new(mpz_srcptr x)
Line 309  cmoOutGMPCoeff_new(mpz_srcptr x)
   return ( ABS (xsize) );    return ( ABS (xsize) );
 }  }
   
 cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)  size_t cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
 {  {
   int i;    int i;
   mp_size_t s;    mp_size_t s;
Line 320  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
Line 326  cmoGetGMPCoeff_new(MP_INT *x, struct cmoBuffer *cb)
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");      fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");
     exit(10);      exit(10);
   }    }
   if (BITS_PER_CHAR != 8) {    if (CHAR_BIT != 8) {
     fprintf(stderr,"BITS_PER_CHAR = %d\n",BITS_PER_CHAR);      fprintf(stderr,"CHAR_BIT = %d\n",CHAR_BIT);
     fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");      fprintf(stderr,"cmo-gmp.c does not work on this CPU.\n");
     fprintf(stderr,"Read the GMP source code and rewrite cmo-gmp.c.\n");  
     exit(10);      exit(10);
   }    }
   

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.11

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>