bridge/class-master/depend/pari/src/basemath/F2x.c
/* If x is a POLMOD, assume modulus is a multiple of T. */
If x is a POLMOD, assume modulus is a multiple of T.
If x is a POLMOD assume modulus is a multiple of T .
GEN
Rg_to_F2xq(GEN x, GEN T)
{
  long ta, tx = typ(x), v = T[1];
  GEN a, b;
  if (is_const_t(tx))
  {
    if (tx == t_FFELT) return FF_to_F2xq(x);
    return Rg_to_F2(x)? pol1_F2x(v): pol0_F2x(v);
  }
  switch(tx)
  {
    case t_POLMOD:
      b = gel(x,1);
      a = gel(x,2); ta = typ(a);
      if (is_const_t(ta)) return Rg_to_F2(a)? pol1_F2x(v): pol0_F2x(v);
      b = RgX_to_F2x(b); if (b[1] != v) break;
      a = RgX_to_F2x(a); if (F2x_equal(b,T)) return a;
      if (lgpol(F2x_rem(b,T))==0) return F2x_rem(a, T);
      break;
    case t_POL:
      x = RgX_to_F2x(x);
      if (x[1] != v) break;
      return F2x_rem(x, T);
    case t_RFRAC:
      a = Rg_to_F2xq(gel(x,1), T);
      b = Rg_to_F2xq(gel(x,2), T);
      return F2xq_div(a,b, T);
  }
  pari_err_TYPE("Rg_to_F2xq",x);
  return NULL; 
}
GEN Rg_to_F2xq ( GEN x , GEN T ) { long ta , tx = typ ( x ) , v = T [ 1 ] ; GEN a , b ; if ( is_const_t ( tx ) ) { if ( tx == t_FFELT ) return FF_to_F2xq ( x ) ; return Rg_to_F2 ( x ) ? pol1_F2x ( v ) : pol0_F2x ( v ) ; } switch ( tx ) { case t_POLMOD : b = gel ( x , 1 ) ; a = gel ( x , 2 ) ; ta = typ ( a ) ; if ( is_const_t ( ta ) ) return Rg_to_F2 ( a ) ? pol1_F2x ( v ) : pol0_F2x ( v ) ; b = RgX_to_F2x ( b ) ; if ( b [ 1 ] != v ) break ; a = RgX_to_F2x ( a ) ; if ( F2x_equal ( b , T ) ) return a ; if ( lgpol ( F2x_rem ( b , T ) ) == 0 ) return F2x_rem ( a , T ) ; break ; case t_POL : x = RgX_to_F2x ( x ) ; if ( x [ 1 ] != v ) break ; return F2x_rem ( x , T ) ; case t_RFRAC : a = Rg_to_F2xq ( gel ( x , 1 ) , T ) ; b = Rg_to_F2xq ( gel ( x , 2 ) , T ) ; return F2xq_div ( a , b , T ) ; } pari_err_TYPE ( " " , x ) ; return NULL ; }
If x is a POLMOD, assume modulus is a multiple of T.
If x is a POLMOD assume modulus is a multiple of T .
/* LCOV_EXCL_LINE */