code: func (c *Container) bitmapToRun(numRuns int32) {
  	statsHit("bitmapToRun")
  	bitmap := c.bitmap()
  	c.mapped = false
  	c.typ = containerRun
  	// return early if empty
  	if c.n == 0 {
  		c.setRuns(nil)
  		return
  	}
  	if numRuns == 0 {
  		numRuns = bitmapCountRuns(bitmap)
  	}
  
  	runs := make([]interval16, 0, numRuns)
  
  	current := bitmap[0]
  	var i, start, last uint16
  	for {
  		// skip while empty
  		for current == 0 && i < bitmapN-1 {
  			i++
  			current = bitmap[i]
  		}
  
  		if current == 0 {
  			break
  		}
  		currentStart := uint16(trailingZeroN(current))
  		start = 64*i + currentStart
  
  		// pad LSBs with 1s
  		current = current | (current - 1)
  
  		// find next 0
  		for current == maxBitmap && i < bitmapN-1 {
  			i++
  			current = bitmap[i]
  		}
  
  		if current == maxBitmap {
  
  			// bitmap[1023] == maxBitmap
  			runs = append(runs, interval16{start, maxContainerVal})
  			break
  		}
  		currentLast := uint16(trailingZeroN(^current))
  		last = 64*i + currentLast
  		runs = append(runs, interval16{start, last - 1})
  
  		// pad LSBs with 0s
  		current = current & (current + 1)
  	}
  	c.setRuns(runs)
  }
docs: // bitmapToRun converts from bitmap format to RLE format.