Faster table compute in mpn_sec_powm

Torbjörn Granlund tg at gmplib.org
Mon Mar 26 09:21:27 UTC 2018


  ***************
  *** 116,128 ****
       size.  */
    #define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n)
    #else
    /* Else use mpn_sqr_basecase for its allowed sizes, else
  mpn_mul_basecase.  */
    #define mpn_local_sqr(rp,up,n,tp) \
      do {									\
  !     if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM))				\
          mpn_sqr_basecase (rp, up, n);					\
        else								\
          mpn_mul_basecase(rp, up, n, up, n);				\
      } while (0)
    #endif
>
  --- 116,129 ----
       size.  */
    #define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n)
    #else
    /* Else use mpn_sqr_basecase for its allowed sizes, else
  mpn_mul_basecase.  */
    #define mpn_local_sqr(rp,up,n,tp) \
      do {									\
  !     if (ABOVE_THRESHOLD (n, SQR_BASECASE_THRESHOLD) &&			\
  ! 	BELOW_THRESHOLD (n, SQR_BASECASE_LIM))				\
          mpn_sqr_basecase (rp, up, n);					\
        else								\
          mpn_mul_basecase(rp, up, n, up, n);				\
      } while (0)
    #endif

I assume SQR_BASECASE_THRESHOLD should be checked for both definitions
of mpn_local_sqr.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list