Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(219)

Unified Diff: libgo/runtime/go-reflect-call.c

Issue 4035044: code review 4035044: Update to current version of Go library. (Closed)
Patch Set: Created 14 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libgo/runtime/go-reflect.c ('k') | libgo/runtime/go-type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libgo/runtime/go-reflect-call.c
===================================================================
--- a/libgo/runtime/go-reflect-call.c
+++ b/libgo/runtime/go-reflect-call.c
@@ -119,6 +119,22 @@
return ret;
}
+/* Return an ffi_type for a Go complex type. */
+
+static ffi_type *
+go_complex_to_ffi (ffi_type *float_type)
+{
+ ffi_type *ret;
+
+ ret = (ffi_type *) __go_alloc (sizeof (ffi_type));
+ ret->type = FFI_TYPE_STRUCT;
+ ret->elements = (ffi_type **) __go_alloc (3 * sizeof (ffi_type *));
+ ret->elements[0] = float_type;
+ ret->elements[1] = float_type;
+ ret->elements[2] = NULL;
+ return ret;
+}
+
/* Return an ffi_type for a type described by a
__go_type_descriptor. */
@@ -141,12 +157,13 @@
if (sizeof (double) == 8)
return &ffi_type_double;
abort ();
- case GO_FLOAT:
- return &ffi_type_float;
case GO_COMPLEX64:
+ if (sizeof (float) == 4)
+ return go_complex_to_ffi (&ffi_type_float);
+ abort ();
case GO_COMPLEX128:
- case GO_COMPLEX:
- /* FIXME. */
+ if (sizeof (double) == 8)
+ return go_complex_to_ffi (&ffi_type_double);
abort ();
case GO_INT16:
return &ffi_type_sint16;
« no previous file with comments | « libgo/runtime/go-reflect.c ('k') | libgo/runtime/go-type.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b