patches/mpfr/2.4.1/140-zeta_ui-shift.patch
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Oct 16 20:57:44 2012 +0200 (2012-10-16)
changeset 3079 37831a33e07e
permissions -rw-r--r--
kernel/linux: fix using custom location

Currently, extract and patch are skipped as thus:
- using a custom directory of pre-installed headers
- a correctly named directory already exists

Otherwise, extract and patch are done.

The current second condition is wrong, because it allows the following
sequence to happen:
- a non-custom kernel is used
- a previous build only partially extracted the non-custom sources
- that p[revious build broke during extraction (eg. incomplete tarball...)
- a subsequent build will find a properly named directory, and will
thus skip extract and patch, which is wrong

Fix that by following the conditions in this table:

Type | Extract | Patch
----------------------+---------+-------
Pre-installed headers | N | N
custom directory | N | N
custom tarball | Y | N
mainstream tarball | Y | Y

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: David Holsgrove <david.holsgrove@xilinx.com>
yann@1322
     1
diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
yann@1322
     2
--- mpfr-2.4.1-a/PATCHES	2009-03-13 02:50:47.000000000 +0000
yann@1322
     3
+++ mpfr-2.4.1-b/PATCHES	2009-03-13 02:50:48.000000000 +0000
yann@1322
     4
@@ -0,0 +1 @@
yann@1322
     5
+zeta_ui-shift
yann@1322
     6
diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
yann@1322
     7
--- mpfr-2.4.1-a/VERSION	2009-03-10 01:44:40.000000000 +0000
yann@1322
     8
+++ mpfr-2.4.1-b/VERSION	2009-03-13 02:50:48.000000000 +0000
yann@1322
     9
@@ -1 +1 @@
yann@1322
    10
-2.4.1-p4
yann@1322
    11
+2.4.1-p5
yann@1322
    12
diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
yann@1322
    13
--- mpfr-2.4.1-a/mpfr.h	2009-03-10 01:44:40.000000000 +0000
yann@1322
    14
+++ mpfr-2.4.1-b/mpfr.h	2009-03-13 02:50:48.000000000 +0000
yann@1322
    15
@@ -27,7 +27,7 @@
yann@1322
    16
 #define MPFR_VERSION_MAJOR 2
yann@1322
    17
 #define MPFR_VERSION_MINOR 4
yann@1322
    18
 #define MPFR_VERSION_PATCHLEVEL 1
yann@1322
    19
-#define MPFR_VERSION_STRING "2.4.1-p4"
yann@1322
    20
+#define MPFR_VERSION_STRING "2.4.1-p5"
yann@1322
    21
 
yann@1322
    22
 /* Macros dealing with MPFR VERSION */
yann@1322
    23
 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
yann@1322
    24
diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
yann@1322
    25
--- mpfr-2.4.1-a/version.c	2009-03-10 01:44:40.000000000 +0000
yann@1322
    26
+++ mpfr-2.4.1-b/version.c	2009-03-13 02:50:48.000000000 +0000
yann@1322
    27
@@ -25,5 +25,5 @@
yann@1322
    28
 const char *
yann@1322
    29
 mpfr_get_version (void)
yann@1322
    30
 {
yann@1322
    31
-  return "2.4.1-p4";
yann@1322
    32
+  return "2.4.1-p5";
yann@1322
    33
 }
yann@1322
    34
diff -Naurd mpfr-2.4.1-a/zeta_ui.c mpfr-2.4.1-b/zeta_ui.c
yann@1322
    35
--- mpfr-2.4.1-a/zeta_ui.c	2009-02-20 09:43:17.000000000 +0000
yann@1322
    36
+++ mpfr-2.4.1-b/zeta_ui.c	2009-03-13 02:50:48.000000000 +0000
yann@1322
    37
@@ -177,7 +177,9 @@
yann@1322
    38
                   mpz_mul_ui (t, t, 2 * k - 1);
yann@1322
    39
                 }
yann@1322
    40
               mpz_div_2exp (t, t, 1);
yann@1322
    41
-              if (n < 1UL << (BITS_PER_MP_LIMB / 2))
yann@1322
    42
+              /* Warning: the test below assumes that an unsigned long
yann@1322
    43
+                 has no padding bits. */
yann@1322
    44
+              if (n < 1UL << ((sizeof(unsigned long) * CHAR_BIT) / 2))
yann@1322
    45
                 /* (n - k + 1) * (n + k - 1) < n^2 */
yann@1322
    46
                 mpz_divexact_ui (t, t, (n - k + 1) * (n + k - 1));
yann@1322
    47
               else