aboutsummaryrefslogtreecommitdiff
path: root/src/internal/runtime/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/runtime/maps')
-rw-r--r--src/internal/runtime/maps/group.go6
-rw-r--r--src/internal/runtime/maps/table.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/internal/runtime/maps/group.go b/src/internal/runtime/maps/group.go
index c8d38ba27c..a56d32aca0 100644
--- a/src/internal/runtime/maps/group.go
+++ b/src/internal/runtime/maps/group.go
@@ -215,6 +215,12 @@ func (g ctrlGroup) matchFull() bitset {
return ctrlGroupMatchFull(g)
}
+// anyFull reports whether any slots in the group are full.
+func (g ctrlGroup) anyFull() bool {
+ // A slot is full iff bit 7 is unset. Test whether any slot has bit 7 unset.
+ return (^g)&bitsetMSB != 0
+}
+
// Portable implementation of matchFull.
//
// Note: On AMD64, this is an intrinsic implemented with SIMD instructions. See
diff --git a/src/internal/runtime/maps/table.go b/src/internal/runtime/maps/table.go
index 49f392b8ae..a8160befd2 100644
--- a/src/internal/runtime/maps/table.go
+++ b/src/internal/runtime/maps/table.go
@@ -606,7 +606,7 @@ func (t *table) Clear(typ *abi.MapType) {
}
for i := uint64(0); i <= t.groups.lengthMask; i++ {
g := t.groups.group(typ, i)
- if g.ctrls().matchFull() != 0 {
+ if g.ctrls().anyFull() {
typedmemclr(typ.Group, g.data)
}
g.ctrls().setEmpty()