[Mesa-dev] [PATCH 18/18] t_dd_dmatmp: Use 'X &= ~N' instead of 'X -= X & N'

Ian Romanick idr at freedesktop.org
Wed Sep 30 13:58:06 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Suggested-by: Brian Paul <brianp at vmware.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 4eff883..3a30142 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -96,7 +96,7 @@ static void TAG(render_lines_verts)(struct gl_context *ctx,
 
    /* Emit whole number of lines in total and in each buffer:
     */
-   count -= count & 1;
+   count &= ~1;
 
    unsigned currentsz = GET_CURRENT_VB_MAX_VERTS() & ~1;
    if (currentsz < 8)
@@ -229,7 +229,7 @@ static void TAG(render_tri_strip_verts)(struct gl_context *ctx,
 
    /* From here on emit even numbers of tris when wrapping over buffers:
     */
-   currentsz -= (currentsz & 1);
+   currentsz &= ~1;
 
    unsigned nr;
    for (unsigned j = 0; j + 2 < count; j += nr - 2) {
@@ -322,7 +322,7 @@ static void TAG(render_quad_strip_verts)(struct gl_context *ctx,
 
       /* Emit whole number of quads in total, and in each buffer.
        */
-      count -= count & 1;
+      count &= ~1;
 
       unsigned currentsz = GET_CURRENT_VB_MAX_VERTS() & ~1;
       if (currentsz < 8)
@@ -352,7 +352,7 @@ static void TAG(render_quads_verts)(struct gl_context *ctx,
       LOCAL_VARS;
 
       /* Emit whole number of quads in total. */
-      count -= count & 3;
+      count &= ~3;
 
       /* Hardware doesn't have a quad primitive type -- try to simulate it using
        * triangle primitive.  This is a win for gears, but is it useful in the
-- 
2.1.0



More information about the mesa-dev mailing list