Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / util / u_vector.c
index 37c4245ebe450260c2bd5ff9fb85dd3cc88090f7..15f8ed6bdad43802220debf6582878db4516fdc1 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+
+#include <string.h>
+#include "util/u_math.h"
 #include "util/u_vector.h"
 
+/** @file u_vector.c
+ *
+ * A dynamically growable, circular buffer.  Elements are added at head and
+ * removed from tail. head and tail are free-running uint32_t indices and we
+ * only compute the modulo with size when accessing the array.  This way,
+ * number of bytes in the queue is always head - tail, even in case of
+ * wraparound.
+ */
+
 int
 u_vector_init(struct u_vector *vector, uint32_t element_size, uint32_t size)
 {
-   assert(util_is_power_of_two(size));
-   assert(element_size < size && util_is_power_of_two(element_size));
+   assert(util_is_power_of_two_nonzero(size));
+   assert(element_size < size && util_is_power_of_two_nonzero(element_size));
 
    vector->head = 0;
    vector->tail = 0;