diff options
author | Brian Paul <brianp@vmware.com> | 2010-02-02 21:17:56 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-02-02 21:17:56 -0700 |
commit | c173eb990a20611ac47c1727e1fb11d7fd3aa0c4 (patch) | |
tree | af15186e54aebf471f6b1691e67baca55bad55cb | |
parent | 3d5e26ebecd2cce4dd6ad7d479a968e1859e11df (diff) |
draw: re-implement free_bit() with ffs()
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_aaline.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 4585dcdb48..54bb9d4b84 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -178,12 +178,7 @@ aa_transform_decl(struct tgsi_transform_context *ctx, static int free_bit(uint bitfield) { - int i; - for (i = 0; i < 32; i++) { - if ((bitfield & (1 << i)) == 0) - return i; - } - return -1; + return ffs(~bitfield) - 1; } diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 0cc2b71864..5f5db7e984 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -171,12 +171,7 @@ pstip_transform_immed(struct tgsi_transform_context *ctx, static int free_bit(uint bitfield) { - int i; - for (i = 0; i < 32; i++) { - if ((bitfield & (1 << i)) == 0) - return i; - } - return -1; + return ffs(~bitfield) - 1; } |