[Mesa-dev] [PATCH 4/7] vl/vlc: add remove bits function

Christian König deathsimple at vodafone.de
Thu Oct 24 15:14:31 CEST 2013


From: Christian König <christian.koenig at amd.com>

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/auxiliary/vl/vl_vlc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/gallium/auxiliary/vl/vl_vlc.h
index 0dc1df9..9f67ba9 100644
--- a/src/gallium/auxiliary/vl/vl_vlc.h
+++ b/src/gallium/auxiliary/vl/vl_vlc.h
@@ -338,4 +338,16 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
    }
 }
 
+/**
+ * remove num_bits bits starting at pos from the bitbuffer
+ */
+static INLINE void
+vl_vlc_removebits(struct vl_vlc *vlc, unsigned pos, unsigned num_bits)
+{
+   uint64_t lo = (vlc->buffer & (~0UL >> (pos + num_bits))) << num_bits;
+   uint64_t hi = (vlc->buffer & (~0UL << (64 - pos)));
+   vlc->buffer = lo | hi;
+   vlc->invalid_bits += num_bits;
+}
+
 #endif /* vl_vlc_h */
-- 
1.8.1.2



More information about the mesa-dev mailing list