MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / deserializeBooleanArray

Function deserializeBooleanArray

client/column_decoder.go:44–83  ·  view source on GitHub ↗
(reader *bytes.Reader, size int32)

Source from the content-addressed store, hash-verified

42}
43
44func deserializeBooleanArray(reader *bytes.Reader, size int32) ([]bool, error) {
45 packedSize := (size + 7) / 8
46 packedBytes := make([]byte, packedSize)
47
48 _, err := reader.Read(packedBytes)
49 if err != nil {
50 return nil, err
51 }
52
53 // read null bits 8 at a time
54 output := make([]bool, size)
55 currentByte := 0
56 fullGroups := int(size) & ^0b111
57 for pos := 0; pos < fullGroups; pos += 8 {
58 b := packedBytes[currentByte]
59 currentByte++
60
61 output[pos+0] = (b & 0b10000000) != 0
62 output[pos+1] = (b & 0b01000000) != 0
63 output[pos+2] = (b & 0b00100000) != 0
64 output[pos+3] = (b & 0b00010000) != 0
65 output[pos+4] = (b & 0b00001000) != 0
66 output[pos+5] = (b & 0b00000100) != 0
67 output[pos+6] = (b & 0b00000010) != 0
68 output[pos+7] = (b & 0b00000001) != 0
69 }
70
71 // read last null bits
72 if remaining := int(size) % 8; remaining > 0 {
73 b := packedBytes[len(packedBytes)-1]
74 mask := uint8(0b10000000)
75
76 for pos := fullGroups; pos < int(size); pos++ {
77 output[pos] = (b & mask) != 0
78 mask >>= 1
79 }
80 }
81
82 return output, nil
83}
84
85type baseColumnDecoder struct{}
86

Callers 2

ReadColumnMethod · 0.85

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…