move readUint64 to new file utils.go

This commit is contained in:
Lucas Clemente
2016-04-08 12:10:21 +02:00
parent 7296d4e55e
commit 1f30d50418
2 changed files with 15 additions and 12 deletions

15
utils.go Normal file
View File

@@ -0,0 +1,15 @@
package quic
import "io"
func readUint64(b io.ByteReader, length uint8) (uint64, error) {
var res uint64
for i := uint8(0); i < length; i++ {
bt, err := b.ReadByte()
if err != nil {
return 0, err
}
res = res<<8 + uint64(bt)
}
return res, nil
}