psi: using binary.BigEndian.Uint64 for TimeFrom

This commit is contained in:
saxon 2018-12-14 16:31:13 +10:30
parent f7991cd0af
commit 7c24c79287
1 changed files with 1 additions and 5 deletions

View File

@ -85,11 +85,7 @@ func TimeFrom(p []byte) (t uint64, err error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
// TODO: could probably write a byte slice to int func, so that this would t = binary.BigEndian.Uint64(p[timeDataIndx : timeDataIndx+timeDataSize])
// be replaced by extraction of time data slice and then call to conversion func
for i := range p[timeDataIndx : timeDataIndx+timeDataSize] {
t |= uint64(p[i+timeDataIndx]) << uint(56-i*timeDataSize)
}
return t, nil return t, nil
} }