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

Method ReadData

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

Source from the content-addressed store, hash-verified

797}
798
799func (s float16ArraySerializer) ReadData(ctx *ReadContext, value reflect.Value) {
800 buf := ctx.Buffer()
801 ctxErr := ctx.Err()
802 size := ctx.ReadBinaryLength()
803 length, ok := checkWireArraySize(ctx, size, 2, value)
804 if !ok {
805 return
806 }
807
808 if length > 0 {
809 if isLittleEndian {
810 ptr := value.Addr().UnsafePointer()
811 buf.Read(unsafe.Slice((*byte)(ptr), size))
812 } else {
813 for i := 0; i < length; i++ {
814 value.Index(i).Set(reflect.ValueOf(float16.Float16FromBits(buf.ReadUint16(ctxErr))))
815 }
816 }
817 }
818}
819
820func (s float16ArraySerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
821 done := readArrayRefAndType(ctx, refMode, readType, value)

Callers 1

ReadMethod · 0.95

Calls 8

checkWireArraySizeFunction · 0.85
ReadBinaryLengthMethod · 0.80
SliceMethod · 0.80
ReadUint16Method · 0.80
ReadMethod · 0.65
BufferMethod · 0.45
ErrMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected