MCPcopy Create free account
hub / github.com/apache/fory / ReadData

Method ReadData

go/fory/array_primitive.go:405–423  ·  view source on GitHub ↗
(ctx *ReadContext, value reflect.Value)

Source from the content-addressed store, hash-verified

403}
404
405func (s float32ArraySerializer) ReadData(ctx *ReadContext, value reflect.Value) {
406 buf := ctx.Buffer()
407 err := ctx.Err()
408 size := ctx.ReadBinaryLength()
409 length, ok := checkWireArraySize(ctx, size, 4, value)
410 if !ok {
411 return
412 }
413 if length > 0 {
414 if isLittleEndian {
415 ptr := value.Addr().UnsafePointer()
416 buf.Read(unsafe.Slice((*byte)(ptr), size))
417 } else {
418 for i := 0; i < length; i++ {
419 value.Index(i).SetFloat(float64(buf.ReadFloat32(err)))
420 }
421 }
422 }
423}
424
425func (s float32ArraySerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
426 done := readArrayRefAndType(ctx, refMode, readType, value)

Callers 1

ReadMethod · 0.95

Calls 8

checkWireArraySizeFunction · 0.85
ReadBinaryLengthMethod · 0.80
SliceMethod · 0.80
ReadMethod · 0.65
float64Function · 0.50
BufferMethod · 0.45
ErrMethod · 0.45
ReadFloat32Method · 0.45

Tested by

no test coverage detected