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

Method WriteData

go/fory/array_primitive.go:445–462  ·  view source on GitHub ↗
(ctx *WriteContext, value reflect.Value)

Source from the content-addressed store, hash-verified

443}
444
445func (s float64ArraySerializer) WriteData(ctx *WriteContext, value reflect.Value) {
446 buf := ctx.Buffer()
447 length := value.Len()
448 size := length * 8
449 buf.WriteLength(size)
450 if length > 0 {
451 if value.CanAddr() && isLittleEndian {
452 // Fast path: direct memory copy - little-endian only
453 ptr := value.Addr().UnsafePointer()
454 buf.WriteBinary(unsafe.Slice((*byte)(ptr), size))
455 } else {
456 // Slow path for non-addressable arrays or big-endian
457 for i := 0; i < length; i++ {
458 buf.WriteFloat64(value.Index(i).Float())
459 }
460 }
461 }
462}
463
464func (s float64ArraySerializer) Write(ctx *WriteContext, refMode RefMode, writeType bool, hasGenerics bool, value reflect.Value) {
465 writeArrayRefAndType(ctx, refMode, writeType, value, FLOAT64_ARRAY)

Callers 1

WriteMethod · 0.95

Calls 6

LenMethod · 0.80
SliceMethod · 0.80
BufferMethod · 0.45
WriteLengthMethod · 0.45
WriteBinaryMethod · 0.45
WriteFloat64Method · 0.45

Tested by

no test coverage detected