util: Replace the usage of redundant u_align_u32 with align and remove u_align_u32
authorYonggang Luo <luoyonggang@gmail.com>
Mon, 19 Jun 2023 19:12:51 +0000 (03:12 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 00:45:30 +0000 (00:45 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23732>

src/util/u_vector.c
src/util/u_vector.h

index 3c5593d..cd23b96 100644 (file)
@@ -78,7 +78,7 @@ u_vector_add(struct u_vector *vector)
           * piece goes to the right locations.  Thanks to the change in
           * size, it may or may not still wrap around.
           */
-         split = u_align_u32(vector->tail, vector->size);
+         split = align(vector->tail, vector->size);
          assert(vector->tail <= split && split < vector->head);
          memcpy((char *)data + dst_tail, (char *)vector->data + src_tail,
                 split - vector->tail);
index 5a1a089..50e706e 100644 (file)
 extern "C" {
 #endif
 
-/* TODO - move to u_math.h - name it better etc */
-static inline uint32_t
-u_align_u32(uint32_t v, uint32_t a)
-{
-   assert(a != 0 && a == (a & -((int32_t) a)));
-   return (v + a - 1) & ~(a - 1);
-}
-
 struct u_vector {
    uint32_t head;
    uint32_t tail;