MCPcopy Index your code
hub / github.com/tinylib/msgp / ReadFloat32Bytes

Function ReadFloat32Bytes

msgp/read_bytes.go:368–382  ·  view source on GitHub ↗

ReadFloat32Bytes tries to read a float32 from 'b' and return the value and the remaining bytes. Possible errors: - [ErrShortBytes] (too few bytes) - [TypeError] (not a float32)

(b []byte)

Source from the content-addressed store, hash-verified

366// - [ErrShortBytes] (too few bytes)
367// - [TypeError] (not a float32)
368func ReadFloat32Bytes(b []byte) (f float32, o []byte, err error) {
369 if len(b) < 5 {
370 err = ErrShortBytes
371 return
372 }
373
374 if b[0] != mfloat32 {
375 err = TypeError{Method: Float32Type, Encoded: getType(b[0])}
376 return
377 }
378
379 f = math.Float32frombits(getMuint32(b))
380 o = b[5:]
381 return
382}
383
384// ReadBoolBytes tries to read a bool
385// from 'b' and return the value and the remaining bytes.

Callers 10

UnmarshalMsgMethod · 0.92
UnmarshalMsgMethod · 0.92
TestReadFloat32BytesFunction · 0.85
UnmarshalMsgMethod · 0.85
FuzzReadBytesFunction · 0.85
rwFloat32BytesFunction · 0.85
ReadFloat64BytesFunction · 0.85
readIntfBytesDepthFunction · 0.85

Calls 2

getTypeFunction · 0.85
getMuint32Function · 0.85

Tested by 4

TestReadFloat32BytesFunction · 0.68
FuzzReadBytesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…