fix: fix again the port of DecodeEndian

This commit is contained in:
Derrick Hammer 2024-01-24 11:23:18 -05:00
parent 91b171d468
commit 047f556d36
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 2 deletions

View File

@ -10,10 +10,12 @@ func EncodeEndian(value uint64, length int) []byte {
return res
}
func DecodeEndian(bytes []byte) uint64 {
var total uint64
var total uint64 = 0
var multiplier uint64 = 1
for _, b := range bytes {
total = total*256 + uint64(b)
total += uint64(b) * multiplier
multiplier *= 256
}
return total