1 /* go-unreflect.c -- implement unsafe.Unreflect for Go.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
11 /* Implement unsafe.Unreflect. */
13 struct __go_empty_interface Unreflect (struct __go_empty_interface type,
15 asm ("libgo_unsafe.unsafe.Unreflect");
17 struct __go_empty_interface
18 Unreflect (struct __go_empty_interface type, void *object)
20 struct __go_empty_interface ret;
22 /* FIXME: We should check __type_descriptor to verify that this is
23 really a type descriptor. */
24 ret.__type_descriptor = type.__object;
25 if (__go_is_pointer_type (ret.__type_descriptor))
26 ret.__object = *(void **) object;
28 ret.__object = object;