summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian König <[email protected]>2013-09-17 07:22:34 -0600
committerChristian König <[email protected]>2014-02-06 16:16:33 +0100
commit9ef42a54a7480272fb3bbedd11c84a8b77dae41f (patch)
treed851fa2193641717dda27fb656d3baa67a9b8999 /src
parentfe0f9ab056c938451bf742e334f49df4d72f0856 (diff)
vl/vlc: add remove bits function
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/vl/vl_vlc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/gallium/auxiliary/vl/vl_vlc.h
index 451fd5edb78..401b50e2563 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 */