bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)


From: Torbjorn Granlund
Subject: bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)
Date: Mon, 17 Sep 2012 18:04:35 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (berkeley-unix)

Jim Meyering <address@hidden> writes:

  Torbjorn Granlund wrote:
  > Jim Meyering <address@hidden> writes:
  >
  >   At least one other change may be interesting to you:
  >   another scope-reduction one:
  >
  >       - inline uintmax_t
  >       + static inline uintmax_t
  >         mulredc (uintmax_t a, uintmax_t b, uintmax_t m, uintmax_t mi)
  >
  > How about going all the way, making everything (but main) static?
  
Please consider these additional changes:

*** .~/cu-factor.c.~1~  Mon Sep 17 11:26:31 2012
--- cu-factor.c Mon Sep 17 15:45:05 2012
***************
*** 134,139 ****
--- 134,140 ----
  #endif
  #define LONGLONG_STANDALONE     /* Don't require GMP's longlong.h mdep files 
*/
  #define ASSERT(x)               /* FIXME make longlong.h really standalone */
+ #define __GMP_DECLSPEC          /* FIXME make longlong.h really standalone */
  #define __clz_tab factor_clz_tab /* Rename to avoid glibc collision */
  #ifndef __GMP_GNUC_PREREQ
  #define __GMP_GNUC_PREREQ(a,b) 1
***************
*** 143,149 ****
  # endif
  # include "longlong.h"
  # ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
! const unsigned char factor_clz_tab[129] =
  {
    1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
--- 144,150 ----
  #endif
  #include "longlong.h"
  #ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
! static const unsigned char factor_clz_tab[129] =
  {
    1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
***************
*** 1555,1561 ****
  {
    mpz_t x, z, y, P;
    mpz_t t, t2;
-   unsigned long long int k, l;
  
    if (flag_verbose > 0)
      {
--- 1556,1561 ----
***************
*** 1567,1574 ****
    mpz_init_set_si (x, 2);
    mpz_init_set_si (z, 2);
    mpz_init_set_ui (P, 1);
!   k = 1;
!   l = 1;
  
    while (mpz_cmp_ui (n, 1) != 0)
      {
--- 1567,1575 ----
    mpz_init_set_si (x, 2);
    mpz_init_set_si (z, 2);
    mpz_init_set_ui (P, 1);
! 
!   unsigned long long int k = 1;
!   unsigned long long int l = 1;
  
    while (mpz_cmp_ui (n, 1) != 0)
      {
***************
*** 2287,2293 ****
  
  /* Read white-space delimited items. Return 1 on success, 0 on EOF.
     Exit on I/O errors. */
! int
  read_item (struct inbuf *bufstruct)
  {
    int c;
--- 2288,2294 ----
  
  /* Read white-space delimited items. Return 1 on success, 0 on EOF.
     Exit on I/O errors. */
! static int
  read_item (struct inbuf *bufstruct)
  {
    int c;
  

-- 
Torbjörn





reply via email to

[Prev in Thread] Current Thread [Next in Thread]