MCPcopy Create free account
hub / github.com/cortexproject/cortex / MarshalToSizedBuffer

Method MarshalToSizedBuffer

pkg/cortexpb/cortex.pb.go:3298–3447  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

3296}
3297
3298func (m *Histogram) MarshalToSizedBuffer(dAtA []byte) (int, error) {
3299 i := len(dAtA)
3300 _ = i
3301 var l int
3302 _ = l
3303 if len(m.CustomValues) > 0 {
3304 for iNdEx := len(m.CustomValues) - 1; iNdEx >= 0; iNdEx-- {
3305 f10 := math.Float64bits(float64(m.CustomValues[iNdEx]))
3306 i -= 8
3307 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f10))
3308 }
3309 i = encodeVarintCortex(dAtA, i, uint64(len(m.CustomValues)*8))
3310 i--
3311 dAtA[i] = 0x1
3312 i--
3313 dAtA[i] = 0x82
3314 }
3315 if m.TimestampMs != 0 {
3316 i = encodeVarintCortex(dAtA, i, uint64(m.TimestampMs))
3317 i--
3318 dAtA[i] = 0x78
3319 }
3320 if m.ResetHint != 0 {
3321 i = encodeVarintCortex(dAtA, i, uint64(m.ResetHint))
3322 i--
3323 dAtA[i] = 0x70
3324 }
3325 if len(m.PositiveCounts) > 0 {
3326 for iNdEx := len(m.PositiveCounts) - 1; iNdEx >= 0; iNdEx-- {
3327 f11 := math.Float64bits(float64(m.PositiveCounts[iNdEx]))
3328 i -= 8
3329 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f11))
3330 }
3331 i = encodeVarintCortex(dAtA, i, uint64(len(m.PositiveCounts)*8))
3332 i--
3333 dAtA[i] = 0x6a
3334 }
3335 if len(m.PositiveDeltas) > 0 {
3336 var j12 int
3337 dAtA14 := make([]byte, len(m.PositiveDeltas)*10)
3338 for _, num := range m.PositiveDeltas {
3339 x13 := (uint64(num) << 1) ^ uint64((num >> 63))
3340 for x13 >= 1<<7 {
3341 dAtA14[j12] = uint8(uint64(x13)&0x7f | 0x80)
3342 j12++
3343 x13 >>= 7
3344 }
3345 dAtA14[j12] = uint8(x13)
3346 j12++
3347 }
3348 i -= j12
3349 copy(dAtA[i:], dAtA14[:j12])
3350 i = encodeVarintCortex(dAtA, i, uint64(j12))
3351 i--
3352 dAtA[i] = 0x62
3353 }
3354 if len(m.PositiveSpans) > 0 {
3355 for iNdEx := len(m.PositiveSpans) - 1; iNdEx >= 0; iNdEx-- {

Callers 3

XXX_MarshalMethod · 0.95
MarshalMethod · 0.95
MarshalToMethod · 0.95

Calls 4

encodeVarintCortexFunction · 0.85
MarshalToSizedBufferMethod · 0.65
SizeMethod · 0.65
MarshalToMethod · 0.65

Tested by

no test coverage detected