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

Method ReadData

csharp/src/Fory/PrimitiveArraySerializers.cs:324–340  ·  view source on GitHub ↗
(ReadContext context)

Source from the content-addressed store, hash-verified

322 }
323
324 public override Half[] ReadData(ReadContext context)
325 {
326 int byteSize = checked((int)context.Reader.ReadVarUInt32());
327 if ((byteSize & 1) != 0)
328 {
329 throw new InvalidDataException("float16 array byte size mismatch");
330 }
331
332 context.Reader.CheckBound(byteSize);
333 Half[] values = new Half[byteSize / 2];
334 for (int i = 0; i < values.Length; i++)
335 {
336 values[i] = BitConverter.UInt16BitsToHalf(context.Reader.ReadUInt16());
337 }
338
339 return values;
340 }
341}
342
343internal sealed class BFloat16ArraySerializer : Serializer<BFloat16[]>

Callers

nothing calls this directly

Calls 3

ReadVarUInt32Method · 0.80
CheckBoundMethod · 0.80
ReadUInt16Method · 0.80

Tested by

no test coverage detected