]> Sergey Matveev's repositories - btrtrc.git/blob - peer_protocol/int.go
Support AllowedFast and enable fast extension
[btrtrc.git] / peer_protocol / int.go
1 package peer_protocol
2
3 import (
4         "encoding/binary"
5         "io"
6 )
7
8 type Integer uint32
9
10 func (i *Integer) Read(r io.Reader) error {
11         return binary.Read(r, binary.BigEndian, i)
12 }
13
14 // It's perfectly fine to cast these to an int. TODO: Or is it?
15 func (i Integer) Int() int {
16         return int(i)
17 }
18
19 func (i Integer) Uint64() uint64 {
20         return uint64(i)
21 }