github.com/webmafia/fast@v0.10.0/binary/buffer_read_int.go (about) 1 package binary 2 3 import ( 4 "encoding/binary" 5 ) 6 7 func (b *BufferReader) ReadInt8() (v int8) { 8 return int8(b.ReadUint8()) 9 } 10 11 // Write int16 (little endian) 12 func (b *BufferReader) ReadInt16() (v int16) { 13 return int16(b.ReadUint16()) 14 } 15 16 // Write int32 17 func (b *BufferReader) ReadInt32() (v int32) { 18 return int32(b.ReadUint32()) 19 } 20 21 // Write int64 22 func (b *BufferReader) ReadInt64() (v int64) { 23 return int64(b.ReadUint64()) 24 } 25 26 // Write int 27 func (b *BufferReader) ReadInt() (v int) { 28 return int(b.ReadUint64()) 29 } 30 31 func (b *BufferReader) ReadVarint() (v int64) { 32 v, n := binary.Varint(b.buf[b.cursor:]) 33 b.cursor += n 34 return 35 }