1 /* go-construct-map.c -- construct a map from an initializer.
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. */
14 extern void *makemap (const struct __go_map_type
*, intgo hint
,
16 __asm__ (GOSYM_PREFIX
"runtime.makemap");
18 extern void *mapassign (const struct __go_map_type
*, void *hmap
,
20 __asm__ (GOSYM_PREFIX
"runtime.mapassign");
23 __go_construct_map (const struct __go_map_type
*type
,
24 uintptr_t count
, uintptr_t entry_size
,
25 uintptr_t val_offset
, const void *ventries
)
28 const unsigned char *entries
;
32 ret
= makemap(type
, (intgo
) count
, NULL
);
34 entries
= (const unsigned char *) ventries
;
35 for (i
= 0; i
< count
; ++i
)
37 p
= mapassign (type
, ret
, entries
);
38 typedmemmove (type
->__val_type
, p
, entries
+ val_offset
);
39 entries
+= entry_size
;