[BACK]Return to ec.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / builtin

Diff for /OpenXM_contrib2/asir2018/builtin/ec.c between version 1.1 and 1.2

version 1.1, 2018/09/19 05:45:05 version 1.2, 2018/09/28 08:20:27
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM$   * $OpenXM: OpenXM_contrib2/asir2018/builtin/ec.c,v 1.1 2018/09/19 05:45:05 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 211  void Pecm_count_order(NODE arg,Z *rp)
Line 211  void Pecm_count_order(NODE arg,Z *rp)
       getmod_lm(&p);        getmod_lm(&p);
       if ( z_bits((Q)p) > 32 )        if ( z_bits((Q)p) > 32 )
         error("ecm_count_order : ground field too large");          error("ecm_count_order : ground field too large");
       p0 = QTOS(p);        p0 = ZTOS(p);
       ec = (VECT)ARG0(arg);        ec = (VECT)ARG0(arg);
       vb = (Obj *)BDY(ec); simp_ff(vb[0],&a); simp_ff(vb[1],&b);        vb = (Obj *)BDY(ec); simp_ff(vb[0],&a); simp_ff(vb[1],&b);
       a0 = LMTOS((LM)a);        a0 = LMTOS((LM)a);
       b0 = LMTOS((LM)b);        b0 = LMTOS((LM)b);
       ord = ecm_count_order_gfp(p0,a0,b0);        ord = ecm_count_order_gfp(p0,a0,b0);
       UTOQ(ord,*rp);        UTOZ(ord,*rp);
       break;        break;
     case FF_GF2N:      case FF_GF2N:
       getmod_gf2n(&d);        getmod_gf2n(&d);
Line 226  void Pecm_count_order(NODE arg,Z *rp)
Line 226  void Pecm_count_order(NODE arg,Z *rp)
       ec = (VECT)ARG0(arg);        ec = (VECT)ARG0(arg);
       vb = (Obj *)BDY(ec); simp_ff(vb[0],&a); simp_ff(vb[1],&b);        vb = (Obj *)BDY(ec); simp_ff(vb[0],&a); simp_ff(vb[1],&b);
       ord = ecm_count_order_gf2n(d,(GF2N)a,(GF2N)b);        ord = ecm_count_order_gf2n(d,(GF2N)a,(GF2N)b);
       UTOQ(ord,*rp);        UTOZ(ord,*rp);
       break;        break;
     default:      default:
       error("ecm_count_order : current_ff is not set");        error("ecm_count_order : current_ff is not set");
Line 236  void Pecm_count_order(NODE arg,Z *rp)
Line 236  void Pecm_count_order(NODE arg,Z *rp)
 void Pecm_set_addcounter(NODE arg,Z *rp)  void Pecm_set_addcounter(NODE arg,Z *rp)
 {  {
   if ( arg )    if ( arg )
     ecm_addcounter = QTOS((Q)ARG0(arg));      ecm_addcounter = ZTOS((Q)ARG0(arg));
   UTOQ(ecm_addcounter,*rp);    UTOZ(ecm_addcounter,*rp);
 }  }
   
 void Pecm_compute_all_key_homo_ff(NODE arg,VECT *rp)  void Pecm_compute_all_key_homo_ff(NODE arg,VECT *rp)
Line 295  void Pnextvect1(NODE arg,Z *rp)
Line 295  void Pnextvect1(NODE arg,Z *rp)
   int index;    int index;
   
   index = nextvect1(ARG0(arg),ARG1(arg));    index = nextvect1(ARG0(arg),ARG1(arg));
   STOQ(index,*rp);    STOZ(index,*rp);
 }  }
   
 /* XXX at least n < 32 must hold. What is the strict restriction for n ? */  /* XXX at least n < 32 must hold. What is the strict restriction for n ? */
Line 315  void Pseparate_vect(NODE arg,LIST *rp)
Line 315  void Pseparate_vect(NODE arg,LIST *rp)
   n = v->len; b = (Z *)v->body;    n = v->len; b = (Z *)v->body;
   w = (double *)ALLOCA(n*sizeof(double));    w = (double *)ALLOCA(n*sizeof(double));
   for ( i = 0; i < n; i++ )    for ( i = 0; i < n; i++ )
     w[i] = (double)QTOS(b[i]);      w[i] = (double)ZTOS(b[i]);
   s = separate_vect(w,n);    s = separate_vect(w,n);
   ns = nc = 0;    ns = nc = 0;
   for ( i = n-1; i >= 0; i-- )    for ( i = n-1; i >= 0; i-- )
     if ( s & (1<<i) ) {      if ( s & (1<<i) ) {
       STOQ(i,iq); MKNODE(t,iq,ns); ns = t;        STOZ(i,iq); MKNODE(t,iq,ns); ns = t;
     } else {      } else {
       STOQ(i,iq); MKNODE(t,iq,nc); nc = t;        STOZ(i,iq); MKNODE(t,iq,nc); nc = t;
     }      }
   MKLIST(ls,ns); MKLIST(lc,nc);    MKLIST(ls,ns); MKLIST(lc,nc);
   MKNODE(t,lc,0); MKNODE(t1,ls,t);    MKNODE(t,lc,0); MKNODE(t1,ls,t);
Line 746  void ecm_find_match(unsigned int *g,int ng,unsigned in
Line 746  void ecm_find_match(unsigned int *g,int ng,unsigned in
   for ( i = 0, c0 = 0; i < ng; i++ ) {    for ( i = 0, c0 = 0; i < ng; i++ ) {
     j = find_match(g[i],b,nb);      j = find_match(g[i],b,nb);
     if ( j >= 0 ) {      if ( j >= 0 ) {
       STOQ(i,iq); STOQ(j,jq);        STOZ(i,iq); STOZ(j,jq);
       MKNODE(n1,jq,0); MKNODE(n0,iq,n1); MKLIST(l,n0);        MKNODE(n1,jq,0); MKNODE(n0,iq,n1); MKLIST(l,n0);
       NEXTNODE(c0,c);        NEXTNODE(c0,c);
       BDY(c) = (pointer)l;        BDY(c) = (pointer)l;
Line 785  int nextvect1(VECT vect,VECT bound)
Line 785  int nextvect1(VECT vect,VECT bound)
   vb = (Z *)vect->body;    vb = (Z *)vect->body;
   bb = (Z *)bound->body;    bb = (Z *)bound->body;
   for ( i = size-1; i >= 0; i-- )    for ( i = size-1; i >= 0; i-- )
     if ( (a=QTOS(vb[i])) < QTOS(bb[i]) ) {      if ( (a=ZTOS(vb[i])) < ZTOS(bb[i]) ) {
       a++; STOQ(a,vb[i]);        a++; STOZ(a,vb[i]);
       break;        break;
     } else      } else
       vb[i] = 0;        vb[i] = 0;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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