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

Method decodeFloat32

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

Source from the content-addressed store, hash-verified

225}
226
227func (d decoder) decodeFloat32(b []byte, p unsafe.Pointer) ([]byte, error) {
228 if hasNullPrefix(b) {
229 return b[4:], nil
230 }
231
232 v, r, _, err := d.parseNumber(b)
233 if err != nil {
234 return d.inputError(b, float32Type)
235 }
236
237 f, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&v)), 32)
238 if err != nil {
239 return d.inputError(b, float32Type)
240 }
241
242 *(*float32)(p) = float32(f)
243 return r, nil
244}
245
246func (d decoder) decodeFloat64(b []byte, p unsafe.Pointer) ([]byte, error) {
247 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