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. */
13 extern void *makemap (const struct maptype
*, intgo hint
, void *)
14 __asm__ (GOSYM_PREFIX
"runtime.makemap");
16 extern void *mapassign (const struct maptype
*, void *hmap
, const void *key
)
17 __asm__ (GOSYM_PREFIX
"runtime.mapassign");
20 __go_construct_map (const struct maptype
*type
, uintptr_t count
,
21 uintptr_t entry_size
, uintptr_t val_offset
,
25 const unsigned char *entries
;
29 ret
= makemap(type
, (intgo
) count
, NULL
);
31 entries
= (const unsigned char *) ventries
;
32 for (i
= 0; i
< count
; ++i
)
34 p
= mapassign (type
, ret
, entries
);
35 typedmemmove (type
->elem
, p
, entries
+ val_offset
);
36 entries
+= entry_size
;