bridge/class-master/depend/pari/src/basemath/gen2.c
/*******************************************************************/
/*                                                                 */
/*                     GENERIC AFFECTATION                         */
/*         Affect the content of x to y, whenever possible         */
/*                                                                 */
/*******************************************************************/
/* x PADIC, Y INT, return lift(x * Mod(1,Y)) */
GENERIC AFFECTATION
Affect the content of x to y, whenever possible


GENERIC AFFECTATION Affect the content of x to y whenever possible
GEN
padic_to_Fp(GEN x, GEN Y) {
  pari_sp av = avma;
  GEN p = gel(x,2), z;
  long vy, vx = valp(x);
  if (!signe(Y)) pari_err_INV("padic_to_Fp",Y);
  vy = Z_pvalrem(Y,p, &z);
  if (vx < 0 || !gequal1(z)) pari_err_OP("",x, mkintmod(gen_1,Y));
  if (vx >= vy) { avma = av; return gen_0; }
  z = gel(x,4);
  if (!signe(z) || vy > vx + precp(x)) pari_err_OP("",x, mkintmod(gen_1,Y));
  if (vx) z = mulii(z, powiu(p,vx));
  return gerepileuptoint(av, remii(z, Y));
}
GEN padic_to_Fp ( GEN x , GEN Y ) { pari_sp av = avma ; GEN p = gel ( x , 2 ) , z ; long vy , vx = valp ( x ) ; if ( ! signe ( Y ) ) pari_err_INV ( " " , Y ) ; vy = Z_pvalrem ( Y , p , & z ) ; if ( vx < 0 || ! gequal1 ( z ) ) pari_err_OP ( " " , x , mkintmod ( gen_1 , Y ) ) ; if ( vx >= vy ) { avma = av ; return gen_0 ; } z = gel ( x , 4 ) ; if ( ! signe ( z ) || vy > vx + precp ( x ) ) pari_err_OP ( " " , x , mkintmod ( gen_1 , Y ) ) ; if ( vx ) z = mulii ( z , powiu ( p , vx ) ) ; return gerepileuptoint ( av , remii ( z , Y ) ) ; }
GENERIC AFFECTATION
Affect the content of x to y, whenever possible
GENERIC AFFECTATION Affect the content of x to y whenever possible