From 9ef42a54a7480272fb3bbedd11c84a8b77dae41f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Tue, 17 Sep 2013 07:22:34 -0600 Subject: [PATCH] vl/vlc: add remove bits function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- 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 451fd5e..401b50e 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 */ -- 2.7.4