MCPcopy Index your code
hub / github.com/segmentio/encoding / decodeFloat64

Method decodeFloat64

json/decode.go:246–263  ·  view source on GitHub ↗
(b []byte, p unsafe.Pointer)

Source from the content-addressed store, hash-verified

244}
245
246func (d decoder) decodeFloat64(b []byte, p unsafe.Pointer) ([]byte, error) {
247 if hasNullPrefix(b) {
248 return b[4:], nil
249 }
250
251 v, r, _, err := d.parseNumber(b)
252 if err != nil {
253 return d.inputError(b, float64Type)
254 }
255
256 f, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&v)), 64)
257 if err != nil {
258 return d.inputError(b, float64Type)
259 }
260
261 *(*float64)(p) = f
262 return r, nil
263}
264
265func (d decoder) decodeNumber(b []byte, p unsafe.Pointer) ([]byte, error) {
266 if hasNullPrefix(b) {

Callers

nothing calls this directly

Calls 3

parseNumberMethod · 0.95
inputErrorMethod · 0.95
hasNullPrefixFunction · 0.85

Tested by

no test coverage detected