nir/worklist: Don't change the start index when computing the tail index
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 3 Mar 2015 01:59:38 +0000 (17:59 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 11 Mar 2015 22:18:16 +0000 (15:18 -0700)
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
src/glsl/nir/nir_worklist.c
src/glsl/nir/nir_worklist.h

index a8baae9375e7bf12ebd364a0b3fac6010d6240ec..3087a1d2354c6e83fd4927193ecca6be12f556be 100644 (file)
@@ -82,7 +82,7 @@ nir_block_worklist_push_head(nir_block_worklist *w, nir_block *block)
 }
 
 nir_block *
-nir_block_worklist_peek_head(nir_block_worklist *w)
+nir_block_worklist_peek_head(const nir_block_worklist *w)
 {
    assert(w->count > 0);
 
@@ -114,18 +114,18 @@ nir_block_worklist_push_tail(nir_block_worklist *w, nir_block *block)
 
    w->count++;
 
-   unsigned tail = w->start = (w->start + w->count - 1) % w->size;
+   unsigned tail = (w->start + w->count - 1) % w->size;
 
    w->blocks[tail] = block;
    BITSET_SET(w->blocks_present, block->index);
 }
 
 nir_block *
-nir_block_worklist_peek_tail(nir_block_worklist *w)
+nir_block_worklist_peek_tail(const nir_block_worklist *w)
 {
    assert(w->count > 0);
 
-   unsigned tail = w->start = (w->start + w->count - 1) % w->size;
+   unsigned tail = (w->start + w->count - 1) % w->size;
 
    return w->blocks[tail];
 }
@@ -135,7 +135,7 @@ nir_block_worklist_pop_tail(nir_block_worklist *w)
 {
    assert(w->count > 0);
 
-   unsigned tail = w->start = (w->start + w->count - 1) % w->size;
+   unsigned tail = (w->start + w->count - 1) % w->size;
 
    w->count--;
 
index d5a8568e428b30915974470a5f7a78207ae40092..829bff24a555f09de58bd7b3cfc1ea88913e4901 100644 (file)
@@ -74,13 +74,13 @@ nir_block_worklist_is_empty(const nir_block_worklist *w)
 
 void nir_block_worklist_push_head(nir_block_worklist *w, nir_block *block);
 
-nir_block *nir_block_worklist_peek_head(nir_block_worklist *w);
+nir_block *nir_block_worklist_peek_head(const nir_block_worklist *w);
 
 nir_block *nir_block_worklist_pop_head(nir_block_worklist *w);
 
 void nir_block_worklist_push_tail(nir_block_worklist *w, nir_block *block);
 
-nir_block *nir_block_worklist_peek_tail(nir_block_worklist *w);
+nir_block *nir_block_worklist_peek_tail(const nir_block_worklist *w);
 
 nir_block *nir_block_worklist_pop_tail(nir_block_worklist *w);