From dade32116f8236650979795f4ec8f2b2dd914b39 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sun, 24 May 2020 12:40:01 +0800 Subject: [PATCH] Simplified bit operation --- bot/world/chunk.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/world/chunk.go b/bot/world/chunk.go index 36fc3a1..bf0342a 100644 --- a/bot/world/chunk.go +++ b/bot/world/chunk.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/Tnze/go-mc/data" pk "github.com/Tnze/go-mc/net/packet" - "math" ) // DecodeChunkColumn decode the chunk data structure. @@ -117,11 +116,12 @@ func (d *directSection) GetBlock(offset int) BlockStatus { func (d *directSection) SetBlock(offset int, s BlockStatus) { offset *= d.bpb padding := offset % 64 - mask := uint64(math.MaxUint64<<(padding+d.bpb) | (1< 64-d.bpb { l := padding - (64 - d.bpb) - d.data[offset/64+1] = d.data[offset/64+1]&(math.MaxUint64<>(64-padding) + const maxUint64 = 1<<64 - 1 + d.data[offset/64+1] = d.data[offset/64+1]&(maxUint64<>(64-padding) } }