aboutsummaryrefslogtreecommitdiffstats
path: root/utils/binary/read.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/binary/read.go')
-rw-r--r--utils/binary/read.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/binary/read.go b/utils/binary/read.go
index c256ffe..50da1ff 100644
--- a/utils/binary/read.go
+++ b/utils/binary/read.go
@@ -94,7 +94,17 @@ const (
lengthBits = uint8(7) // subsequent bytes has 7 bits to store the length
)
-// ReadUint32 reads 4 bytes and returns them as a Big ndian uint32
+// ReadUint64 reads 8 bytes and returns them as a BigEndian uint32
+func ReadUint64(r io.Reader) (uint64, error) {
+ var v uint64
+ if err := binary.Read(r, binary.BigEndian, &v); err != nil {
+ return 0, err
+ }
+
+ return v, nil
+}
+
+// ReadUint32 reads 4 bytes and returns them as a BigEndian uint32
func ReadUint32(r io.Reader) (uint32, error) {
var v uint32
if err := binary.Read(r, binary.BigEndian, &v); err != nil {