From a8af23b57f672fef05637de531bba5aa00013364 Mon Sep 17 00:00:00 2001 From: chyroc Date: Fri, 24 Apr 2020 08:56:04 +0800 Subject: [PATCH] opt: reuse var leafPageElementSize (#215) --- page.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/page.go b/page.go index b5c1699..415cd77 100644 --- a/page.go +++ b/page.go @@ -56,7 +56,7 @@ func (p *page) meta() *meta { // leafPageElement retrieves the leaf node by index func (p *page) leafPageElement(index uint16) *leafPageElement { - off := uintptr(index) * unsafe.Sizeof(leafPageElement{}) + off := uintptr(index) * leafPageElementSize return (*leafPageElement)(unsafe.Pointer(uintptr(unsafe.Pointer(p)) + unsafe.Sizeof(*p) + off)) }