1
0
mirror of https://github.com/fumiama/unibase2n.git synced 2026-06-25 06:09:50 +08:00

完善 pack

This commit is contained in:
源文雨
2022-09-30 22:10:05 +08:00
parent 74b92c0711
commit 71948481ee
5 changed files with 53 additions and 6 deletions

View File

@@ -2,7 +2,6 @@ package unibase2n
import (
"encoding/binary"
"math/bits"
"unsafe"
)
@@ -49,9 +48,7 @@ func New(pack Pack) *Base {
*(*Pack)(unsafe.Pointer(b)) = pack
return b
}
// change to native endian
n := bits.Reverse64(uint64(pack))
field := (*[8]byte)(unsafe.Pointer(&n))
field := (*[8]byte)(unsafe.Pointer(&pack))
if isitle { // packed in little endian but I am big
b.off = binary.BigEndian.Uint16(field[6:8])
b.til = binary.BigEndian.Uint16(field[4:6])