mpn_bdiv_q_2

Joe keane jgk at panix.com
Mon Sep 28 21:26:33 UTC 2015


I wrote a new function "mpn_bdiv_q_2".  It still could be cleaned up,
but it passes my tests.  It should be pretty fast.

*** gmp-6.0.0/mpn/divexact.c	2014-03-25 10:37:55.000000000 -0400
--- gmp-opt/mpn/divexact.c	2015-09-27 18:26:34.416304000 -0400
*************** mpn_divexact (mp_ptr qp,
*** 96,103 ****
    if (dn > qn)
      dn = qn;
  
!   tp = TMP_ALLOC_LIMBS (mpn_bdiv_q_itch (qn, dn));
!   mpn_bdiv_q (qp, np, qn, dp, dn, tp);
    TMP_FREE;
  }
  
--- 96,112 ----
    if (dn > qn)
      dn = qn;
  
!   if (dn == 2)
!     mpn_bdiv_q_2 (qp, np, qn, dp);
!   else
!   {
!     mp_size_t ti;
! 
!     ti = mpn_bdiv_q_itch (qn, dn);
!     tp = TMP_ALLOC_LIMBS (ti);
!     mpn_bdiv_q (qp, np, qn, dp, dn, tp);
!   }
! 
    TMP_FREE;
  }
  


More information about the gmp-devel mailing list