mirror of
https://github.com/golang/go
synced 2024-11-17 16:14:42 -07:00
runtime: remove indentation in mapiternext
Invert the condition and continue, to remove indentation. Change-Id: Id62a5d9abc9a4df1193bcf15f95f70f2c2e2abac Reviewed-on: https://go-review.googlesource.com/55091 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
This commit is contained in:
parent
f5804ce4f3
commit
e0789d734d
@ -820,88 +820,89 @@ next:
|
||||
offi := (i + it.offset) & (bucketCnt - 1)
|
||||
k := add(unsafe.Pointer(b), dataOffset+uintptr(offi)*uintptr(t.keysize))
|
||||
v := add(unsafe.Pointer(b), dataOffset+bucketCnt*uintptr(t.keysize)+uintptr(offi)*uintptr(t.valuesize))
|
||||
if b.tophash[offi] != empty && b.tophash[offi] != evacuatedEmpty {
|
||||
if checkBucket != noCheck && !h.sameSizeGrow() {
|
||||
// Special case: iterator was started during a grow to a larger size
|
||||
// and the grow is not done yet. We're working on a bucket whose
|
||||
// oldbucket has not been evacuated yet. Or at least, it wasn't
|
||||
// evacuated when we started the bucket. So we're iterating
|
||||
// through the oldbucket, skipping any keys that will go
|
||||
// to the other new bucket (each oldbucket expands to two
|
||||
// buckets during a grow).
|
||||
k2 := k
|
||||
if t.indirectkey {
|
||||
k2 = *((*unsafe.Pointer)(k2))
|
||||
if b.tophash[offi] == empty || b.tophash[offi] == evacuatedEmpty {
|
||||
continue
|
||||
}
|
||||
if checkBucket != noCheck && !h.sameSizeGrow() {
|
||||
// Special case: iterator was started during a grow to a larger size
|
||||
// and the grow is not done yet. We're working on a bucket whose
|
||||
// oldbucket has not been evacuated yet. Or at least, it wasn't
|
||||
// evacuated when we started the bucket. So we're iterating
|
||||
// through the oldbucket, skipping any keys that will go
|
||||
// to the other new bucket (each oldbucket expands to two
|
||||
// buckets during a grow).
|
||||
k2 := k
|
||||
if t.indirectkey {
|
||||
k2 = *((*unsafe.Pointer)(k2))
|
||||
}
|
||||
if t.reflexivekey || alg.equal(k2, k2) {
|
||||
// If the item in the oldbucket is not destined for
|
||||
// the current new bucket in the iteration, skip it.
|
||||
hash := alg.hash(k2, uintptr(h.hash0))
|
||||
if hash&(uintptr(1)<<it.B-1) != checkBucket {
|
||||
continue
|
||||
}
|
||||
if t.reflexivekey || alg.equal(k2, k2) {
|
||||
// If the item in the oldbucket is not destined for
|
||||
// the current new bucket in the iteration, skip it.
|
||||
hash := alg.hash(k2, uintptr(h.hash0))
|
||||
if hash&(uintptr(1)<<it.B-1) != checkBucket {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
// Hash isn't repeatable if k != k (NaNs). We need a
|
||||
// repeatable and randomish choice of which direction
|
||||
// to send NaNs during evacuation. We'll use the low
|
||||
// bit of tophash to decide which way NaNs go.
|
||||
// NOTE: this case is why we need two evacuate tophash
|
||||
// values, evacuatedX and evacuatedY, that differ in
|
||||
// their low bit.
|
||||
if checkBucket>>(it.B-1) != uintptr(b.tophash[offi]&1) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
// Hash isn't repeatable if k != k (NaNs). We need a
|
||||
// repeatable and randomish choice of which direction
|
||||
// to send NaNs during evacuation. We'll use the low
|
||||
// bit of tophash to decide which way NaNs go.
|
||||
// NOTE: this case is why we need two evacuate tophash
|
||||
// values, evacuatedX and evacuatedY, that differ in
|
||||
// their low bit.
|
||||
if checkBucket>>(it.B-1) != uintptr(b.tophash[offi]&1) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if b.tophash[offi] != evacuatedX && b.tophash[offi] != evacuatedY {
|
||||
// this is the golden data, we can return it.
|
||||
if t.indirectkey {
|
||||
k = *((*unsafe.Pointer)(k))
|
||||
}
|
||||
if b.tophash[offi] != evacuatedX && b.tophash[offi] != evacuatedY {
|
||||
// this is the golden data, we can return it.
|
||||
if t.indirectkey {
|
||||
k = *((*unsafe.Pointer)(k))
|
||||
}
|
||||
it.key = k
|
||||
if t.indirectvalue {
|
||||
v = *((*unsafe.Pointer)(v))
|
||||
}
|
||||
it.value = v
|
||||
} else {
|
||||
// The hash table has grown since the iterator was started.
|
||||
// The golden data for this key is now somewhere else.
|
||||
k2 := k
|
||||
if t.indirectkey {
|
||||
k2 = *((*unsafe.Pointer)(k2))
|
||||
}
|
||||
if t.reflexivekey || alg.equal(k2, k2) {
|
||||
// Check the current hash table for the data.
|
||||
// This code handles the case where the key
|
||||
// has been deleted, updated, or deleted and reinserted.
|
||||
// NOTE: we need to regrab the key as it has potentially been
|
||||
// updated to an equal() but not identical key (e.g. +0.0 vs -0.0).
|
||||
rk, rv := mapaccessK(t, h, k2)
|
||||
if rk == nil {
|
||||
continue // key has been deleted
|
||||
}
|
||||
it.key = k
|
||||
it.key = rk
|
||||
it.value = rv
|
||||
} else {
|
||||
// if key!=key then the entry can't be deleted or
|
||||
// updated, so we can just return it. That's lucky for
|
||||
// us because when key!=key we can't look it up
|
||||
// successfully in the current table.
|
||||
it.key = k2
|
||||
if t.indirectvalue {
|
||||
v = *((*unsafe.Pointer)(v))
|
||||
}
|
||||
it.value = v
|
||||
} else {
|
||||
// The hash table has grown since the iterator was started.
|
||||
// The golden data for this key is now somewhere else.
|
||||
k2 := k
|
||||
if t.indirectkey {
|
||||
k2 = *((*unsafe.Pointer)(k2))
|
||||
}
|
||||
if t.reflexivekey || alg.equal(k2, k2) {
|
||||
// Check the current hash table for the data.
|
||||
// This code handles the case where the key
|
||||
// has been deleted, updated, or deleted and reinserted.
|
||||
// NOTE: we need to regrab the key as it has potentially been
|
||||
// updated to an equal() but not identical key (e.g. +0.0 vs -0.0).
|
||||
rk, rv := mapaccessK(t, h, k2)
|
||||
if rk == nil {
|
||||
continue // key has been deleted
|
||||
}
|
||||
it.key = rk
|
||||
it.value = rv
|
||||
} else {
|
||||
// if key!=key then the entry can't be deleted or
|
||||
// updated, so we can just return it. That's lucky for
|
||||
// us because when key!=key we can't look it up
|
||||
// successfully in the current table.
|
||||
it.key = k2
|
||||
if t.indirectvalue {
|
||||
v = *((*unsafe.Pointer)(v))
|
||||
}
|
||||
it.value = v
|
||||
}
|
||||
}
|
||||
it.bucket = bucket
|
||||
if it.bptr != b { // avoid unnecessary write barrier; see issue 14921
|
||||
it.bptr = b
|
||||
}
|
||||
it.i = i + 1
|
||||
it.checkBucket = checkBucket
|
||||
return
|
||||
}
|
||||
it.bucket = bucket
|
||||
if it.bptr != b { // avoid unnecessary write barrier; see issue 14921
|
||||
it.bptr = b
|
||||
}
|
||||
it.i = i + 1
|
||||
it.checkBucket = checkBucket
|
||||
return
|
||||
}
|
||||
b = b.overflow(t)
|
||||
i = 0
|
||||
|
Loading…
Reference in New Issue
Block a user