Skip to content

Commit

Permalink
long double is C89 and can be used without configure probing
Browse files Browse the repository at this point in the history
  • Loading branch information
plobsing committed Feb 28, 2011
1 parent bc5a4ed commit 4724695
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
5 changes: 0 additions & 5 deletions include/parrot/datatypes.h
Expand Up @@ -15,7 +15,6 @@

/* TODO: detect these with configure */
#define HAS_LONGLONG 0
#define HAS_LONGDOUBLE 0

/* &gen_from_enum(datatypes.pasm) subst(s/enum_type_(\w+)/uc("DATATYPE_$1")/e) */
typedef enum {
Expand Down Expand Up @@ -111,11 +110,7 @@ const struct _data_types data_types[] = {
/* native float types */
{ "float", sizeof (float), ALIGNOF(float) },
{ "double", sizeof (double), ALIGNOF(double) },
# if HAS_LONGDOUBLE
{ "longdouble", sizeof (long double), ALIGNOF(long double)},
# else
{ "longdouble", 0, 0 },
# endif

/* explicitly sized integer types */
{ "int8", 1, ALIGNOF(int /* TODO */) },
Expand Down
19 changes: 4 additions & 15 deletions src/pmc/structview.pmc
Expand Up @@ -187,14 +187,12 @@ C<INTVAL>, C<FLOATVAL>, C<STRING>, and C<PMC>

Integer: C<char>, C<uchar>, C<short>, C<ushort>, C<int>, C<uint>, C<long>,
C<ulong>, C<longlong> (*), and C<ulonglong> (*)
Float: C<float>, C<double>, C<longdouble> (**)
PMC: data pointer (C<ptr>), function pointer (C<func_ptr>), buffer (C<sized>) (***)
Float: C<float>, C<double>, C<longdouble>
PMC: data pointer (C<ptr>), function pointer (C<func_ptr>), buffer (C<sized>) (**)

(*) Only available if your C system sports a C<long long> type.
(*) Only available if your C system sports a C<long long> type.

(**) Only available if your C system sports a C<long double> type.

(***) Requires 2 additional following parameters - buffer size and alignment.
(**) Requires 2 additional following parameters - buffer size and alignment.

=item Explicitly Sized Types

Expand Down Expand Up @@ -311,9 +309,7 @@ C<uint16>, C<int32>, C<uint32>, C<int64>(*), and C<uint64>(*)
case enum_type_FLOATVAL:
case enum_type_float:
case enum_type_double:
#if HAS_LONGDOUBLE
case enum_type_longdouble:
#endif
elt_access = num_access;
break;

Expand All @@ -340,9 +336,6 @@ C<uint16>, C<int32>, C<uint32>, C<int64>(*), and C<uint64>(*)
#if !HAS_64BIT
case enum_type_int64:
case enum_type_uint64:
#endif
#if !HAS_LONGDOUBLE
case enum_type_longdouble:
#endif
Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
"Unsupported struct element type `%Ss' (index %d)",
Expand Down Expand Up @@ -652,10 +645,8 @@ Get/Set a float-like element from a struct-pointer PMC.
return *(float *)ptr;
case enum_type_double:
return *(double *)ptr;
#if HAS_LONGDOUBLE
case enum_type_longdouble:
return *(long double *)ptr;
#endif
}
default:
Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
Expand All @@ -678,11 +669,9 @@ Get/Set a float-like element from a struct-pointer PMC.
case enum_type_double:
*(double *)ptr = n;
return;
#if HAS_LONGDOUBLE
case enum_type_longdouble:
*(long double *)ptr = n;
return;
#endif
}
default:
Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
Expand Down

0 comments on commit 4724695

Please sign in to comment.