[vlc-devel] commit: Optimized a bit bs_skip. (Laurent Aimar )

git version control git at videolan.org
Mon Jan 12 22:26:16 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Jan 12 22:06:43 2009 +0100| [c90c5e397973276638dd41c610414eb563f03829] | committer: Laurent Aimar 

Optimized a bit bs_skip.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c90c5e397973276638dd41c610414eb563f03829
---

 include/vlc_bits.h |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 4dcfa2f..778493c 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -132,10 +132,12 @@ static inline void bs_skip( bs_t *s, int i_count )
 {
     s->i_left -= i_count;
 
-    while( s->i_left <= 0 )
+    if( s->i_left <= 0 )
     {
-        s->p++;
-        s->i_left += 8;
+        const int i_bytes = ( -s->i_left + 8 ) / 8;
+
+        s->p += i_bytes;
+        s->i_left += 8 * i_bytes;
     }
 }
 




More information about the vlc-devel mailing list