]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/m4/minloc1.m4
Update copyright years.
[thirdparty/gcc.git] / libgfortran / m4 / minloc1.m4
CommitLineData
4ee9c684 1`/* Implementation of the MINLOC intrinsic
f1717362 2 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4ee9c684 3 Contributed by Paul Brook <paul@nowt.org>
4
b4ba8232 5This file is part of the GNU Fortran runtime library (libgfortran).
4ee9c684 6
7Libgfortran is free software; you can redistribute it and/or
b417ea8c 8modify it under the terms of the GNU General Public
4ee9c684 9License as published by the Free Software Foundation; either
6bc9506f 10version 3 of the License, or (at your option) any later version.
4ee9c684 11
12Libgfortran is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b417ea8c 15GNU General Public License for more details.
4ee9c684 16
6bc9506f 17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
4ee9c684 25
41f2d5e8 26#include "libgfortran.h"
4ee9c684 27#include <stdlib.h>
28#include <assert.h>
41f2d5e8 29#include <limits.h>'
4ee9c684 30
31include(iparm.m4)dnl
32include(ifunction.m4)dnl
920e54ef 33
34`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
35
4ee9c684 36ARRAY_FUNCTION(0,
7ebee933 37` atype_name minval;
38#if defined ('atype_inf`)
39 minval = atype_inf;
40#else
41 minval = atype_max;
42#endif
43 result = 1;',
44`#if defined ('atype_nan`)
45 if (*src <= minval)
46 {
47 minval = *src;
48 result = (rtype_name)n + 1;
49 break;
50 }
51 }
52 for (; n < len; n++, src += delta)
53 {
54#endif
55 if (*src < minval)
56 {
57 minval = *src;
58 result = (rtype_name)n + 1;
59 }')
4ee9c684 60
61MASKED_ARRAY_FUNCTION(0,
7ebee933 62` atype_name minval;
63#if defined ('atype_inf`)
64 minval = atype_inf;
65#else
66 minval = atype_max;
67#endif
68#if defined ('atype_nan`)
69 rtype_name result2 = 0;
70#endif
71 result = 0;',
72` if (*msrc)
73 {
74#if defined ('atype_nan`)
75 if (!result2)
76 result2 = (rtype_name)n + 1;
77 if (*src <= minval)
78#endif
79 {
80 minval = *src;
81 result = (rtype_name)n + 1;
82 break;
83 }
84 }
85 }
86#if defined ('atype_nan`)
87 if (unlikely (n >= len))
88 result = result2;
89 else
90#endif
91 for (; n < len; n++, src += delta, msrc += mdelta)
92 {
93 if (*msrc && *src < minval)
94 {
95 minval = *src;
96 result = (rtype_name)n + 1;
b4ba8232 97 }', `')
4ee9c684 98
4292b27d 99SCALAR_ARRAY_FUNCTION(0)
100
920e54ef 101#endif