mirror of
https://github.com/golang/go
synced 2024-11-26 21:21:34 -07:00
runtime: node ordering in mTreap; adjust code to reflect description.
This commit is contained in:
parent
4295ed9bef
commit
93f749b670
@ -164,10 +164,10 @@ func (root *mTreap) insert(span *mspan) {
|
|||||||
pt = &t.right
|
pt = &t.right
|
||||||
} else if t.npagesKey > npages {
|
} else if t.npagesKey > npages {
|
||||||
pt = &t.left
|
pt = &t.left
|
||||||
} else if uintptr(unsafe.Pointer(t.spanKey)) < uintptr(unsafe.Pointer(span)) {
|
} else if t.spanKey.base() < span.base() {
|
||||||
// t.npagesKey == npages, so sort on span addresses.
|
// t.npagesKey == npages, so sort on span addresses.
|
||||||
pt = &t.right
|
pt = &t.right
|
||||||
} else if uintptr(unsafe.Pointer(t.spanKey)) > uintptr(unsafe.Pointer(span)) {
|
} else if t.spanKey.base() > span.base() {
|
||||||
pt = &t.left
|
pt = &t.left
|
||||||
} else {
|
} else {
|
||||||
throw("inserting span already in treap")
|
throw("inserting span already in treap")
|
||||||
@ -271,9 +271,9 @@ func (root *mTreap) removeSpan(span *mspan) {
|
|||||||
t = t.right
|
t = t.right
|
||||||
} else if t.npagesKey > npages {
|
} else if t.npagesKey > npages {
|
||||||
t = t.left
|
t = t.left
|
||||||
} else if uintptr(unsafe.Pointer(t.spanKey)) < uintptr(unsafe.Pointer(span)) {
|
} else if t.spanKey.base() < span.base() {
|
||||||
t = t.right
|
t = t.right
|
||||||
} else if uintptr(unsafe.Pointer(t.spanKey)) > uintptr(unsafe.Pointer(span)) {
|
} else if t.spanKey.base() > span.base() {
|
||||||
t = t.left
|
t = t.left
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user