bitwindow.cc
来自「pixil 最新的嵌入linux 應用程序集,別的地方很難下載」· CC 代码 · 共 65 行
CC
65 行
/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae Portions Copyright (c) 2003 Century Software, Inc. All Rights Reserved. */// Bitwindow.cc// It's bit reservior for MPEG layer 3#ifdef HAVE_CONFIG_H#include "config.h"#endif#include "mpegsound.h"#ifndef WORDS_BIGENDIAN#define _KEY 0#else#define _KEY 3#endifintMpegbitwindow::getbits(int bits){ union { char store[4]; int current; } u; int bi; if (!bits) return 0; u.current = 0; bi = (bitindex & 7); // u.store[_KEY]=buffer[(bitindex>>3)&(WINDOWSIZE-1)]<<bi; u.store[_KEY] = buffer[bitindex >> 3] << bi; bi = 8 - bi; bitindex += bi; while (bits) { if (!bi) { // u.store[_KEY]=buffer[(bitindex>>3)&(WINDOWSIZE-1)]; u.store[_KEY] = buffer[bitindex >> 3]; bitindex += 8; bi = 8; } if (bits >= bi) { u.current <<= bi; bits -= bi; bi = 0; } else { u.current <<= bits; bi -= bits; bits = 0; } } bitindex -= bi; return (u.current >> 8);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?