Merge pull request #171 from muesli/conversion-fixes

Avoid unnecessary conversions
pull/176/head
Gyuho Lee 2019-08-06 11:18:37 -07:00 committed by GitHub
commit 62396cbb20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -774,7 +774,7 @@ func (cmd *PageCommand) PrintFreelist(w io.Writer, buf []byte) error {
// Print each page in the freelist.
ids := (*[maxAllocSize]pgid)(unsafe.Pointer(&p.ptr))
for i := int(idx); i < count; i++ {
for i := idx; i < count; i++ {
fmt.Fprintf(w, "%d\n", ids[i])
}
fmt.Fprintf(w, "\n")

View File

@ -366,7 +366,7 @@ func (c *Cursor) node() *node {
}
for _, ref := range c.stack[:len(c.stack)-1] {
_assert(!n.isLeaf, "expected branch node")
n = n.childAt(int(ref.index))
n = n.childAt(ref.index)
}
_assert(n.isLeaf, "expected leaf node")
return n

View File

@ -27,7 +27,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid {
f.allocs[pid] = txid
for i := pgid(0); i < pgid(n); i++ {
delete(f.cache, pid+pgid(i))
delete(f.cache, pid+i)
}
return pid
}