fix: need to use BigEndian to encode little?
This commit is contained in:
parent
a708380639
commit
936450f9e6
|
@ -4,7 +4,7 @@ import "encoding/binary"
|
||||||
|
|
||||||
func EncodeEndian(value uint64, length int) []byte {
|
func EncodeEndian(value uint64, length int) []byte {
|
||||||
byteSlice := make([]byte, length)
|
byteSlice := make([]byte, length)
|
||||||
binary.LittleEndian.PutUint64(byteSlice, value)
|
binary.BigEndian.PutUint64(byteSlice, value)
|
||||||
return byteSlice
|
return byteSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,5 @@ func DecodeEndian(byteSlice []byte) uint64 {
|
||||||
buffer := make([]byte, 8)
|
buffer := make([]byte, 8)
|
||||||
copy(buffer, byteSlice)
|
copy(buffer, byteSlice)
|
||||||
|
|
||||||
return binary.LittleEndian.Uint64(buffer)
|
return binary.BigEndian.Uint64(buffer)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue