FS#8961 - Anti-Aliased Fonts.
[kugel-rb/myfork.git] / apps / codecs / libffmpegFLAC / bitstream.c
blobe53ec0fd4672cbc4873de7b1b6aac896d29875f4
1 /*
2 * Common bit i/o utils
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at>
23 /**
24 * @file bitstream.c
25 * bitstream api.
28 #include <stdio.h>
29 #include "bitstream.h"
31 /* bit input functions */
33 /**
34 * reads 0-32 bits.
36 unsigned int get_bits_long(GetBitContext *s, int n){
37 if(n<=17) return get_bits(s, n);
38 else{
39 int ret= get_bits(s, 16) << (n-16);
40 return ret | get_bits(s, n-16);
44 /**
45 * shows 0-32 bits.
47 unsigned int show_bits_long(GetBitContext *s, int n){
48 if(n<=17) return show_bits(s, n);
49 else{
50 GetBitContext gb= *s;
51 int ret= get_bits_long(s, n);
52 *s= gb;
53 return ret;
57 void align_get_bits(GetBitContext *s)
59 int n= (-get_bits_count(s)) & 7;
60 if(n) skip_bits(s, n);