annotate libgfortran/io/size_from_kind.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1 /* Copyright (C) 2005-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
2 Contributed by Janne Blomqvist
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of the GNU Fortran runtime library (libgfortran).
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 Libgfortran is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 any later version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 Libgfortran is distributed in the hope that it will be useful,
kono
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
14 GNU General Public License for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /* This file contains utility functions for determining the size of a
kono
parents:
diff changeset
27 variable given its kind. */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 #include "io.h"
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 size_t
kono
parents:
diff changeset
32 size_from_real_kind (int kind)
kono
parents:
diff changeset
33 {
kono
parents:
diff changeset
34 switch (kind)
kono
parents:
diff changeset
35 {
kono
parents:
diff changeset
36 #ifdef HAVE_GFC_REAL_4
kono
parents:
diff changeset
37 case 4:
kono
parents:
diff changeset
38 return sizeof (GFC_REAL_4);
kono
parents:
diff changeset
39 #endif
kono
parents:
diff changeset
40 #ifdef HAVE_GFC_REAL_8
kono
parents:
diff changeset
41 case 8:
kono
parents:
diff changeset
42 return sizeof (GFC_REAL_8);
kono
parents:
diff changeset
43 #endif
kono
parents:
diff changeset
44 #ifdef HAVE_GFC_REAL_10
kono
parents:
diff changeset
45 case 10:
kono
parents:
diff changeset
46 return sizeof (GFC_REAL_10);
kono
parents:
diff changeset
47 #endif
kono
parents:
diff changeset
48 #ifdef HAVE_GFC_REAL_16
kono
parents:
diff changeset
49 case 16:
kono
parents:
diff changeset
50 return sizeof (GFC_REAL_16);
kono
parents:
diff changeset
51 #endif
kono
parents:
diff changeset
52 default:
kono
parents:
diff changeset
53 return kind;
kono
parents:
diff changeset
54 }
kono
parents:
diff changeset
55 }
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 size_t
kono
parents:
diff changeset
59 size_from_complex_kind (int kind)
kono
parents:
diff changeset
60 {
kono
parents:
diff changeset
61 switch (kind)
kono
parents:
diff changeset
62 {
kono
parents:
diff changeset
63 #ifdef HAVE_GFC_COMPLEX_4
kono
parents:
diff changeset
64 case 4:
kono
parents:
diff changeset
65 return sizeof (GFC_COMPLEX_4);
kono
parents:
diff changeset
66 #endif
kono
parents:
diff changeset
67 #ifdef HAVE_GFC_COMPLEX_8
kono
parents:
diff changeset
68 case 8:
kono
parents:
diff changeset
69 return sizeof (GFC_COMPLEX_8);
kono
parents:
diff changeset
70 #endif
kono
parents:
diff changeset
71 #ifdef HAVE_GFC_COMPLEX_10
kono
parents:
diff changeset
72 case 10:
kono
parents:
diff changeset
73 return sizeof (GFC_COMPLEX_10);
kono
parents:
diff changeset
74 #endif
kono
parents:
diff changeset
75 #ifdef HAVE_GFC_COMPLEX_16
kono
parents:
diff changeset
76 case 16:
kono
parents:
diff changeset
77 return sizeof (GFC_COMPLEX_16);
kono
parents:
diff changeset
78 #endif
kono
parents:
diff changeset
79 default:
kono
parents:
diff changeset
80 return 2 * kind;
kono
parents:
diff changeset
81 }
kono
parents:
diff changeset
82 }
kono
parents:
diff changeset
83