MCPcopy Create free account
hub / github.com/tendermint/tendermint / stringIndented

Method stringIndented

libs/bits/bit_array.go:316–340  ·  view source on GitHub ↗
(indent string)

Source from the content-addressed store, hash-verified

314}
315
316func (bA *BitArray) stringIndented(indent string) string {
317 lines := []string{}
318 bits := ""
319 for i := 0; i < bA.Bits; i++ {
320 if bA.getIndex(i) {
321 bits += "x"
322 } else {
323 bits += "_"
324 }
325 if i%100 == 99 {
326 lines = append(lines, bits)
327 bits = ""
328 }
329 if i%10 == 9 {
330 bits += indent
331 }
332 if i%50 == 49 {
333 bits += indent
334 }
335 }
336 if len(bits) > 0 {
337 lines = append(lines, bits)
338 }
339 return fmt.Sprintf("BA{%v:%v}", bA.Bits, strings.Join(lines, indent))
340}
341
342// Bytes returns the byte representation of the bits within the bitarray.
343func (bA *BitArray) Bytes() []byte {

Callers 1

StringIndentedMethod · 0.95

Calls 1

getIndexMethod · 0.95

Tested by

no test coverage detected