| 1 |
// Copyright 2024 Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build !goexperiment.swissmap |
| 6 |
|
| 7 |
package reflect |
| 8 |
|
| 9 |
import ( |
| 10 |
"internal/abi" |
| 11 |
"unsafe" |
| 12 |
) |
| 13 |
|
| 14 |
func MapBucketOf(x, y Type) Type { |
| 15 |
return toType(bucketOf(x.common(), y.common())) |
| 16 |
} |
| 17 |
|
| 18 |
func CachedBucketOf(m Type) Type { |
| 19 |
t := m.(*rtype) |
| 20 |
if Kind(t.t.Kind_&abi.KindMask) != Map { |
| 21 |
panic("not map") |
| 22 |
} |
| 23 |
tt := (*mapType)(unsafe.Pointer(t)) |
| 24 |
return toType(tt.Bucket) |
| 25 |
} |