code: func (c *Container) bitmapToArray() {
  	statsHit("bitmapToArray")
  	bitmap := c.bitmap()
  	c.setBitmap(nil)
  	c.typ = containerArray
  	c.mapped = false
  
  	// return early if empty
  	if c.n == 0 {
  		c.setArray(nil)
  		return
  	}
  	n := int32(0)
  
  	array := make([]uint16, c.n)
  	for i, word := range bitmap {
  		for word != 0 {
  			t := word & -word
  			if roaringParanoia {
  				if n >= c.n {
  					panic("bitmap has more bits set than container.n")
  				}
  			}
  			array[n] = uint16((i*64 + int(popcount(t-1))))
  			n++
  			word ^= t
  		}
  	}
  	if roaringParanoia {
  		if n != c.n {
  			panic("bitmap has fewer bits set than container.n")
  		}
  	}
  	c.setArray(array)
  }
docs: // bitmapToArray converts from bitmap format to array format.