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

Function WriteUint32Slice

go/fory/slice_primitive.go:957–969  ·  view source on GitHub ↗

WriteUint32Slice writes []uint32 to buffer using ARRAY protocol

(buf *ByteBuffer, value []uint32)

Source from the content-addressed store, hash-verified

955
956// WriteUint32Slice writes []uint32 to buffer using ARRAY protocol
957func WriteUint32Slice(buf *ByteBuffer, value []uint32) {
958 size := len(value) * 4
959 buf.WriteLength(size)
960 if len(value) > 0 {
961 if isLittleEndian {
962 buf.WriteBinary(unsafe.Slice((*byte)(unsafe.Pointer(&value[0])), size))
963 } else {
964 for i := 0; i < len(value); i++ {
965 buf.WriteInt32(int32(value[i]))
966 }
967 }
968 }
969}
970
971// ReadUint32Slice reads []uint32 from buffer using ARRAY protocol
972func ReadUint32Slice(buf *ByteBuffer, err *Error) []uint32 {

Callers 2

WriteDataMethod · 0.85
WriteUint32SliceMethod · 0.85

Calls 5

SliceMethod · 0.80
int32Function · 0.50
WriteLengthMethod · 0.45
WriteBinaryMethod · 0.45
WriteInt32Method · 0.45

Tested by

no test coverage detected