Home | History | Annotate | Download | only in go

Lines Matching refs:buf

22 func GetByte(buf []byte) byte {
23 return byte(GetUint8(buf))
27 func GetBool(buf []byte) bool {
28 return buf[0] == 1
32 func GetUint8(buf []byte) (n uint8) {
33 n = uint8(buf[0])
38 func GetUint16(buf []byte) (n uint16) {
39 n |= uint16(buf[0])
40 n |= uint16(buf[1]) << 8
45 func GetUint32(buf []byte) (n uint32) {
46 n |= uint32(buf[0])
47 n |= uint32(buf[1]) << 8
48 n |= uint32(buf[2]) << 16
49 n |= uint32(buf[3]) << 24
54 func GetUint64(buf []byte) (n uint64) {
55 n |= uint64(buf[0])
56 n |= uint64(buf[1]) << 8
57 n |= uint64(buf[2]) << 16
58 n |= uint64(buf[3]) << 24
59 n |= uint64(buf[4]) << 32
60 n |= uint64(buf[5]) << 40
61 n |= uint64(buf[6]) << 48
62 n |= uint64(buf[7]) << 56
67 func GetInt8(buf []byte) (n int8) {
68 n = int8(buf[0])
73 func GetInt16(buf []byte) (n int16) {
74 n |= int16(buf[0])
75 n |= int16(buf[1]) << 8
80 func GetInt32(buf []byte) (n int32) {
81 n |= int32(buf[0])
82 n |= int32(buf[1]) << 8
83 n |= int32(buf[2]) << 16
84 n |= int32(buf[3]) << 24
89 func GetInt64(buf []byte) (n int64) {
90 n |= int64(buf[0])
91 n |= int64(buf[1]) << 8
92 n |= int64(buf[2]) << 16
93 n |= int64(buf[3]) << 24
94 n |= int64(buf[4]) << 32
95 n |= int64(buf[5]) << 40
96 n |= int64(buf[6]) << 48
97 n |= int64(buf[7]) << 56
102 func GetFloat32(buf []byte) float32 {
103 x := GetUint32(buf)
108 func GetFloat64(buf []byte) float64 {
109 x := GetUint64(buf)
114 func GetUOffsetT(buf []byte) UOffsetT {
115 return UOffsetT(GetInt32(buf))
119 func GetSOffsetT(buf []byte) SOffsetT {
120 return SOffsetT(GetInt32(buf))
124 func GetVOffsetT(buf []byte) VOffsetT {
125 return VOffsetT(GetUint16(buf))
129 func WriteByte(buf []byte, n byte) {
130 WriteUint8(buf, uint8(n))
134 func WriteBool(buf []byte, b bool) {
135 buf[0] = 0
137 buf[0] = 1
142 func WriteUint8(buf []byte, n uint8) {
143 buf[0] = byte(n)
147 func WriteUint16(buf []byte, n uint16) {
148 buf[0] = byte(n)
149 buf[1] = byte(n >> 8)
153 func WriteUint32(buf []byte, n uint32) {
154 buf[0] = byte(n)
155 buf[1] = byte(n >> 8)
156 buf[2] = byte(n >> 16)
157 buf[3] = byte(n >> 24)
161 func WriteUint64(buf []byte, n uint64) {
163 buf[i] = byte(n >> (i * 8))
168 func WriteInt8(buf []byte, n int8) {
169 buf[0] = byte(n)
173 func WriteInt16(buf []byte, n int16) {
174 buf[0] = byte(n)
175 buf[1] = byte(n >> 8)
179 func WriteInt32(buf []byte, n int32) {
180 buf[0] = byte(n)
181 buf[1] = byte(n >> 8)
182 buf[2] = byte(n >> 16)
183 buf[3] = byte(n >> 24)
187 func WriteInt64(buf []byte, n int64) {
189 buf[i] = byte(n >> (i * 8))
194 func WriteFloat32(buf []byte, n float32) {
195 WriteUint32(buf, math.Float32bits(n))
199 func WriteFloat64(buf []byte, n float64) {
200 WriteUint64(buf, math.Float64bits(n))
204 func WriteVOffsetT(buf []byte, n VOffsetT) {
205 WriteUint16(buf, uint16(n))
209 func WriteSOffsetT(buf []byte, n SOffsetT) {
210 WriteInt32(buf, int32(n))
214 func WriteUOffsetT(buf []byte, n UOffsetT) {
215 WriteUint32(buf, uint32(n))