ReadInt64Slice reads []int64 from buffer using ARRAY protocol
(buf *ByteBuffer, err *Error)
| 880 | |
| 881 | // ReadInt64Slice reads []int64 from buffer using ARRAY protocol |
| 882 | func ReadInt64Slice(buf *ByteBuffer, err *Error) []int64 { |
| 883 | byteSize := buf.ReadLength(err) |
| 884 | if err.HasError() { |
| 885 | return nil |
| 886 | } |
| 887 | if byteSize%8 != 0 { |
| 888 | *err = DeserializationErrorf("array byte size %d is not aligned to element size %d", byteSize, 8) |
| 889 | return nil |
| 890 | } |
| 891 | if byteSize == 0 { |
| 892 | return make([]int64, 0) |
| 893 | } |
| 894 | if !buf.CheckReadable(byteSize, err) { |
| 895 | return nil |
| 896 | } |
| 897 | length := byteSize / 8 |
| 898 | if isLittleEndian { |
| 899 | result := make([]int64, length) |
| 900 | buf.Read(unsafe.Slice((*byte)(unsafe.Pointer(&result[0])), byteSize)) |
| 901 | return result |
| 902 | } else { |
| 903 | result := make([]int64, length) |
| 904 | for i := 0; i < length; i++ { |
| 905 | result[i] = buf.ReadInt64(err) |
| 906 | } |
| 907 | return result |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | // WriteUint16Slice writes []uint16 to buffer using ARRAY protocol |
| 912 | func WriteUint16Slice(buf *ByteBuffer, value []uint16) { |
no test coverage detected