]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/libgfortran/lib/contrib/generated/bessel_r10.c
Update
[l4.git] / l4 / pkg / libgfortran / lib / contrib / generated / bessel_r10.c
index 93d08d6ce6d03793e20d435b0f2c0b8ce013b391..d58ad5113339d26569e84fc6d5e157924558a7ad 100644 (file)
@@ -1,6 +1,6 @@
 /* Implementation of the BESSEL_JN and BESSEL_YN transformational
    function using a recurrence algorithm.
-   Copyright 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2015 Free Software Foundation, Inc.
    Contributed by Tobias Burnus <burnus@net-b.de>
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -51,11 +51,11 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (ret->data == NULL)
+  if (ret->base_addr == NULL)
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
       ret->offset = 0;
     }
 
@@ -72,21 +72,20 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x
 
   if (unlikely (x == 0))
     {
-      ret->data[0] = 1;
+      ret->base_addr[0] = 1;
       for (i = 1; i <= n2-n1; i++)
-        ret->data[i*stride] = 0;
+        ret->base_addr[i*stride] = 0;
       return;
     }
 
-  ret->data = ret->data;
   last1 = MATHFUNC(jn) (n2, x);
-  ret->data[(n2-n1)*stride] = last1;
+  ret->base_addr[(n2-n1)*stride] = last1;
 
   if (n1 == n2)
     return;
 
   last2 = MATHFUNC(jn) (n2 - 1, x);
-  ret->data[(n2-n1-1)*stride] = last2;
+  ret->base_addr[(n2-n1-1)*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
@@ -95,9 +94,9 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x
 
   for (i = n2-n1-2; i >= 0; i--)
     {
-      ret->data[i*stride] = x2rev * (i+1+n1) * last2 - last1;
+      ret->base_addr[i*stride] = x2rev * (i+1+n1) * last2 - last1;
       last1 = last2;
-      last2 = ret->data[i*stride];
+      last2 = ret->base_addr[i*stride];
     }
 }
 
@@ -119,11 +118,11 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2,
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
-  if (ret->data == NULL)
+  if (ret->base_addr == NULL)
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
       ret->offset = 0;
     }
 
@@ -142,41 +141,40 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2,
     {
       for (i = 0; i <= n2-n1; i++)
 #if defined(GFC_REAL_10_INFINITY)
-        ret->data[i*stride] = -GFC_REAL_10_INFINITY;
+        ret->base_addr[i*stride] = -GFC_REAL_10_INFINITY;
 #else
-        ret->data[i*stride] = -GFC_REAL_10_HUGE;
+        ret->base_addr[i*stride] = -GFC_REAL_10_HUGE;
 #endif
       return;
     }
 
-  ret->data = ret->data;
   last1 = MATHFUNC(yn) (n1, x);
-  ret->data[0] = last1;
+  ret->base_addr[0] = last1;
 
   if (n1 == n2)
     return;
 
   last2 = MATHFUNC(yn) (n1 + 1, x);
-  ret->data[1*stride] = last2;
+  ret->base_addr[1*stride] = last2;
 
   if (n1 + 1 == n2)
     return;
 
   x2rev = GFC_REAL_10_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined(GFC_REAL_10_INFINITY)
       if (unlikely (last2 == -GFC_REAL_10_INFINITY))
        {
-         ret->data[i*stride] = -GFC_REAL_10_INFINITY;
+         ret->base_addr[i*stride] = -GFC_REAL_10_INFINITY;
        }
       else
 #endif
        {
-         ret->data[i*stride] = x2rev * (i-1+n1) * last2 - last1;
+         ret->base_addr[i*stride] = x2rev * (i-1+n1) * last2 - last1;
          last1 = last2;
-         last2 = ret->data[i*stride];
+         last2 = ret->base_addr[i*stride];
        }
     }
 }