MCPcopy
hub / github.com/tinylib/msgp / ReadFloat64Bytes

Function ReadFloat64Bytes

msgp/read_bytes.go:333–359  ·  view source on GitHub ↗

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

(b []byte)

Source from the content-addressed store, hash-verified

331// - [ErrShortBytes] (too few bytes)
332// - [TypeError] (not a float64)
333func ReadFloat64Bytes(b []byte) (f float64, o []byte, err error) {
334 if len(b) < 9 {
335 if len(b) >= 5 && b[0] == mfloat32 {
336 var tf float32
337 tf, o, err = ReadFloat32Bytes(b)
338 f = float64(tf)
339 return
340 }
341 err = ErrShortBytes
342 return
343 }
344
345 if b[0] != mfloat64 {
346 if b[0] == mfloat32 {
347 var tf float32
348 tf, o, err = ReadFloat32Bytes(b)
349 f = float64(tf)
350 return
351 }
352 err = badPrefix(Float64Type, b[0])
353 return
354 }
355
356 f = math.Float64frombits(getMuint64(b))
357 o = b[9:]
358 return
359}
360
361// ReadFloat32Bytes tries to read a float32
362// from 'b' and return the value and the remaining bytes.

Callers 11

UnmarshalMsgMethod · 0.92
UnmarshalMsgMethod · 0.92
TestReadFloat64BytesFunction · 0.85
UnmarshalMsgMethod · 0.85
FuzzReadBytesFunction · 0.85
rwFloat64BytesFunction · 0.85
TestAppendFloatFunction · 0.85
readIntfBytesDepthFunction · 0.85
ReadJSONNumberBytesFunction · 0.85

Calls 3

ReadFloat32BytesFunction · 0.85
badPrefixFunction · 0.85
getMuint64Function · 0.85

Tested by 5

TestReadFloat64BytesFunction · 0.68
FuzzReadBytesFunction · 0.68
TestAppendFloatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…