diff --git a/pkg/bytes/is_zero_filled_amd64.go b/pkg/bytes/is_zero_filled_amd64.go index 4dd96c11..34c69960 100644 --- a/pkg/bytes/is_zero_filled_amd64.go +++ b/pkg/bytes/is_zero_filled_amd64.go @@ -8,18 +8,16 @@ package bytes import ( - "reflect" "unsafe" ) // IsZeroFilled returns true if b consists of zeros only. func IsZeroFilled(b []byte) bool { - hdr := (*reflect.SliceHeader)((unsafe.Pointer)(&b)) - data := unsafe.Pointer(hdr.Data) - length := hdr.Len + length := len(b) if length == 0 { return true } + var data = unsafe.Pointer(&b[0]) if uintptr(data)&0x07 != 0 { // the data is not aligned, fallback to a simple way