MCPcopy
hub / github.com/uber/aresdb / CompareArray

Function CompareArray

memstore/common/data_value.go:126–138  ·  view source on GitHub ↗

CompareArray compare array values, the main purpose of this comparsion is for equal comparison larger/less comparision may not be accurate

(dataType DataType, a, b unsafe.Pointer)

Source from the content-addressed store, hash-verified

124// CompareArray compare array values, the main purpose of this comparsion is for equal comparison
125// larger/less comparision may not be accurate
126func CompareArray(dataType DataType, a, b unsafe.Pointer) int {
127 len1 := int(*(*uint32)(a))
128 len2 := int(*(*uint32)(b))
129 if len1 != len2 {
130 return len1 - len2
131 }
132 if len1 == 0 {
133 return 0
134 }
135 bytes := CalculateListElementBytes(dataType, len1)
136 // skip 4 bytes for length
137 return utils.MemCmp(a, b, 4, bytes)
138}
139
140// ArrayLengthCompare compare
141func ArrayLengthCompare(v1, v2 *DataValue) int {

Callers 1

CompareMethod · 0.85

Calls 2

MemCmpFunction · 0.92

Tested by

no test coverage detected