ssa: map range/next

This commit is contained in:
visualfc
2024-06-29 20:43:12 +08:00
parent 2ccd1625e7
commit 28ebce6b65
5 changed files with 373 additions and 53 deletions

View File

@@ -57,6 +57,22 @@ func MapAccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool)
return mapaccess2(t, h, key)
}
func NewMapIter(t *maptype, h *hmap) *hiter {
var it hiter
mapiterinit(t, h, &it)
return &it
}
func MapIterNext(it *hiter) (ok bool, k unsafe.Pointer, v unsafe.Pointer) {
if it.key == nil {
return
}
ok = true
k, v = it.key, it.elem
mapiternext(it)
return
}
func mapKeyEqual(t *maptype, p, q unsafe.Pointer) bool {
if isDirectIface(t.Key) {
switch t.Key.Size_ {