=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/engine/gfs.c,v retrieving revision 1.13 retrieving revision 1.17 diff -u -p -r1.13 -r1.17 --- OpenXM_contrib2/asir2000/engine/gfs.c 2002/09/30 06:13:07 1.13 +++ OpenXM_contrib2/asir2000/engine/gfs.c 2003/05/07 06:26:49 1.17 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/engine/gfs.c,v 1.12 2002/09/27 08:40:49 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/engine/gfs.c,v 1.16 2003/01/16 00:33:28 noro Exp $ */ #include "ca.h" #include "inline.h" @@ -661,15 +661,15 @@ int mulremum_enc(int p,int n,UM dp,int a,int b) void gfs_galois_action(GFS a,Q e,GFS *c) { - Q q; + Q p; int i,k; GFS t,s; t = a; k = QTOS(e); - STOQ(current_gfs_q,q); + STOQ(current_gfs_p,p); for ( i = 0; i < k; i++ ) { - pwrgfs(t,q,&s); t = s; + pwrgfs(t,p,&s); t = s; } *c = t; } @@ -727,6 +727,8 @@ void qtogfs(Q a,GFS *c) { int s; + if ( a && (SGN(a) < 1) ) + error("qtogfs : invalid argument"); s = QTOS(a)%current_gfs_q; itogfs(s,c); } @@ -750,6 +752,21 @@ void gfstomq(GFS a,MQ *c) } } +void gfstopgfs(GFS a,V v,P *c) +{ + MQ t; + Q q; + + if ( !a ) + *c = 0; + else if ( !current_gfs_ntoi ) { + UTOMQ(CONT(a),t); + STOQ(CONT(t),q); + *c = (P)q; + } else + enc_to_p(current_gfs_p,current_gfs_iton[CONT(a)],v,c); +} + void ntogfs(Obj a,GFS *b) { P t; @@ -1132,7 +1149,12 @@ int _itosf(int n) { int i; + /* XXX */ +#if 0 n %= current_gfs_p; +#else + n %= current_gfs_q; +#endif if ( !n ) return 0; i = !current_gfs_ntoi ? n : current_gfs_ntoi[n];