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

Function WriteUintSlice

go/fory/slice_primitive.go:1316–1342  ·  view source on GitHub ↗

WriteUintSlice writes []uint to buffer using ARRAY protocol

(buf *ByteBuffer, value []uint)

Source from the content-addressed store, hash-verified

1314
1315// WriteUintSlice writes []uint to buffer using ARRAY protocol
1316func WriteUintSlice(buf *ByteBuffer, value []uint) {
1317 if strconv.IntSize == 64 {
1318 size := len(value) * 8
1319 buf.WriteLength(size)
1320 if len(value) > 0 {
1321 if isLittleEndian {
1322 buf.WriteBinary(unsafe.Slice((*byte)(unsafe.Pointer(&value[0])), size))
1323 } else {
1324 for i := 0; i < len(value); i++ {
1325 buf.WriteInt64(int64(value[i]))
1326 }
1327 }
1328 }
1329 } else {
1330 size := len(value) * 4
1331 buf.WriteLength(size)
1332 if len(value) > 0 {
1333 if isLittleEndian {
1334 buf.WriteBinary(unsafe.Slice((*byte)(unsafe.Pointer(&value[0])), size))
1335 } else {
1336 for i := 0; i < len(value); i++ {
1337 buf.WriteInt32(int32(value[i]))
1338 }
1339 }
1340 }
1341 }
1342}
1343
1344// ReadUintSlice reads []uint from buffer using ARRAY protocol
1345func ReadUintSlice(buf *ByteBuffer, err *Error) []uint {

Callers 2

WriteDataMethod · 0.85
WriteUintSliceMethod · 0.85

Calls 7

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

Tested by

no test coverage detected