bit_input.c
来自「算术码编码代码源程序」· C语言 代码 · 共 32 行
C
32 行
/* BIT INPUT ROUTINES. */#include <stdio.h>/* THE BIT BUFFER. */static int buffer; /* Bits waiting to be input */static int bits_to_go; /* Number of bits still in buffer *//* INITIALIZE BIT INPUT. */start_inputing_bits(){ bits_to_go = 0; /* Buffer starts out with */} /* no bits in it. *//* INPUT A BIT. */int input_bit(){ int t; bits_to_go -= 1; if (bits_to_go<0) { /* Read the next byte if no */ buffer = getc(stdin); /* bits are left in the */ bits_to_go = 7; /* buffer. Return anything */ } /* after end-of-file. */ t = buffer&1; buffer >>= 1; /* Return the next bit from */ return t; /* the bottom of the byte. */}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?