MCPcopy
hub / github.com/openacid/slim / GetBytes

Method GetBytes

array/base.go:161–169  ·  view source on GitHub ↗

GetBytes retrieves the raw data of value in []byte at "idx" and return it. Performance note Involves 2 memory access: a.Bitmaps a.Elts Involves 0 alloc Since 0.2.0

(idx int32, eltsize int)

Source from the content-addressed store, hash-verified

159//
160// Since 0.2.0
161func (a *Base) GetBytes(idx int32, eltsize int) ([]byte, bool) {
162 r, b := bitmap.Rank64(a.Bitmaps, a.Offsets, idx)
163 if b == 0 {
164 return nil, false
165 }
166
167 stIdx := int32(eltsize) * r
168 return a.Elts[stIdx : stIdx+int32(eltsize)], true
169}

Callers 2

GetMethod · 0.95
BenchmarkBaseGetBytesFunction · 0.95

Calls

no outgoing calls

Tested by 1

BenchmarkBaseGetBytesFunction · 0.76