- Add Bugzilla PRs to ChangeLog reverting AIX long double size.
[official-gcc.git] / libgo / runtime / go-unsafe-newarray.c
blob3bea2829f784f8eeea5efb012381c97168168017
1 /* go-unsafe-newarray.c -- unsafe.NewArray function 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. */
7 #include "go-alloc.h"
8 #include "go-type.h"
9 #include "interface.h"
11 /* Implement unsafe.NewArray. */
13 void *NewArray (struct __go_empty_interface type, int n)
14 asm ("libgo_unsafe.unsafe.NewArray");
16 /* The dynamic type of the argument will be a pointer to a type
17 descriptor. */
19 void *
20 NewArray (struct __go_empty_interface type, int n)
22 const struct __go_type_descriptor *descriptor;
24 /* FIXME: We should check __type_descriptor to verify that this is
25 really a type descriptor. */
26 descriptor = (const struct __go_type_descriptor *) type.__object;
27 return __go_alloc (descriptor->__size * n);