Mesa (master): st/mesa: change some loops from while to do..while in st_atom_array.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 14 23:52:32 UTC 2020


Module: Mesa
Branch: master
Commit: e3617fd00b311bd4f32886974c574ae55ba416fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3617fd00b311bd4f32886974c574ae55ba416fd

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Jan 23 21:08:30 2020 -0500

st/mesa: change some loops from while to do..while in st_atom_array.c

Reviewed-by: Mathias Fröhlich <mathias.froehlich at web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3829>

---

 src/mesa/state_tracker/st_atom_array.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c
index 040c25b9651..8075ecbd9a3 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -176,7 +176,7 @@ st_setup_arrays(struct st_context *st,
       /* We can assume that we have array for the binding */
       assert(attrmask);
       /* Walk attributes belonging to the binding */
-      while (attrmask) {
+      do {
          const gl_vert_attrib attr = u_bit_scan(&attrmask);
          const struct gl_array_attributes *const attrib
             = _mesa_draw_array_attrib(vao, attr);
@@ -184,7 +184,7 @@ st_setup_arrays(struct st_context *st,
          init_velement(vp, velements, &attrib->Format, off,
                        binding->InstanceDivisor, bufidx,
                        input_to_index[attr]);
-      }
+      } while (attrmask);
    }
 }
 
@@ -211,7 +211,7 @@ st_setup_current(struct st_context *st,
       const unsigned bufidx = (*num_vbuffers)++;
       unsigned max_alignment = 1;
 
-      while (curmask) {
+      do {
          const gl_vert_attrib attr = u_bit_scan(&curmask);
          const struct gl_array_attributes *const attrib
             = _mesa_draw_current_attrib(ctx, attr);
@@ -226,7 +226,7 @@ st_setup_current(struct st_context *st,
                        bufidx, input_to_index[attr]);
 
          cursor += alignment;
-      }
+      } while (curmask);
 
       vbuffer[bufidx].is_user_buffer = false;
       vbuffer[bufidx].buffer.resource = NULL;



More information about the mesa-commit mailing list