OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libgfortran/] [io/] [size_from_kind.c] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* Copyright (C) 2005 Free Software Foundation, Inc.
2
   Contributed by Janne Blomqvist
3
 
4
This file is part of the GNU Fortran runtime library (libgfortran).
5
 
6
Libgfortran is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
In addition to the permissions in the GNU General Public License, the
12
Free Software Foundation gives you unlimited permission to link the
13
compiled version of this file into combinations with other programs,
14
and to distribute those combinations without any restriction coming
15
from the use of this file.  (The General Public License restrictions
16
do apply in other respects; for example, they cover modification of
17
the file, and distribution when not linked into a combine
18
executable.)
19
 
20
Libgfortran is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
GNU General Public License for more details.
24
 
25
You should have received a copy of the GNU General Public License
26
along with Libgfortran; see the file COPYING.  If not, write to
27
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28
Boston, MA 02110-1301, USA.  */
29
 
30
 
31
/* This file contains utility functions for determining the size of a
32
   variable given its kind. */
33
 
34
#include "config.h"
35
#include "libgfortran.h"
36
#include "io.h"
37
 
38
size_t
39
size_from_real_kind (int kind)
40
{
41
  switch (kind)
42
    {
43
#ifdef HAVE_GFC_REAL_4
44
    case 4:
45
      return sizeof (GFC_REAL_4);
46
#endif
47
#ifdef HAVE_GFC_REAL_8
48
    case 8:
49
      return sizeof (GFC_REAL_8);
50
#endif
51
#ifdef HAVE_GFC_REAL_10
52
    case 10:
53
      return sizeof (GFC_REAL_10);
54
#endif
55
#ifdef HAVE_GFC_REAL_16
56
    case 16:
57
      return sizeof (GFC_REAL_16);
58
#endif
59
    default:
60
      return kind;
61
    }
62
}
63
 
64
 
65
size_t
66
size_from_complex_kind (int kind)
67
{
68
  switch (kind)
69
    {
70
#ifdef HAVE_GFC_COMPLEX_4
71
    case 4:
72
      return sizeof (GFC_COMPLEX_4);
73
#endif
74
#ifdef HAVE_GFC_COMPLEX_8
75
    case 8:
76
      return sizeof (GFC_COMPLEX_8);
77
#endif
78
#ifdef HAVE_GFC_COMPLEX_10
79
    case 10:
80
      return sizeof (GFC_COMPLEX_10);
81
#endif
82
#ifdef HAVE_GFC_COMPLEX_16
83
    case 16:
84
      return sizeof (GFC_COMPLEX_16);
85
#endif
86
    default:
87
      return 2 * kind;
88
    }
89
}
90
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.