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

Function WriteInt16Slice

go/fory/slice_primitive.go:777–789  ·  view source on GitHub ↗

WriteInt16Slice writes []int16 to buffer using ARRAY protocol

(buf *ByteBuffer, value []int16)

Source from the content-addressed store, hash-verified

775
776// WriteInt16Slice writes []int16 to buffer using ARRAY protocol
777func WriteInt16Slice(buf *ByteBuffer, value []int16) {
778 size := len(value) * 2
779 buf.WriteLength(size)
780 if len(value) > 0 {
781 if isLittleEndian {
782 buf.WriteBinary(unsafe.Slice((*byte)(unsafe.Pointer(&value[0])), size))
783 } else {
784 for i := 0; i < len(value); i++ {
785 buf.WriteInt16(value[i])
786 }
787 }
788 }
789}
790
791// ReadInt16Slice reads []int16 from buffer using ARRAY protocol
792func ReadInt16Slice(buf *ByteBuffer, err *Error) []int16 {

Callers 3

WriteDataMethod · 0.85
SerializeFunction · 0.85
WriteInt16SliceMethod · 0.85

Calls 4

SliceMethod · 0.80
WriteLengthMethod · 0.45
WriteBinaryMethod · 0.45
WriteInt16Method · 0.45

Tested by

no test coverage detected