diff options
author | Brian Paul <[email protected]> | 2010-02-02 21:17:56 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-02-02 21:17:56 -0700 |
commit | c173eb990a20611ac47c1727e1fb11d7fd3aa0c4 (patch) | |
tree | af15186e54aebf471f6b1691e67baca55bad55cb /src/gallium/auxiliary | |
parent | 3d5e26ebecd2cce4dd6ad7d479a968e1859e11df (diff) |
draw: re-implement free_bit() with ffs()
Diffstat (limited to 'src/gallium/auxiliary')
-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 4585dcdb48a..54bb9d4b84a 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 0cc2b718641..5f5db7e984b 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; } |