⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hexline.c

📁 语音CELP压缩解压源代码(C语音)
💻 C
字号:
/**************************************************************************** ROUTINE*               puthex (pack an array of bits into a bitstream)** FUNCTION*               Input an array of bits and number of bits and the*               program returns a pointer to a bitstream.** SYNOPSIS*               subroutine puthex(nb, bits, line)**   formal **                       data    I/O*       name            type    type    function*       -------------------------------------------------------------------*       nb		int	i	number of bits*       bits		int	i	bit array*       line		char	o	packed character bitstream****************************************************************************** DESCRIPTION**       This program packs an array of bits into a string of hex*       characters where each character represents 4 bits.  The *	character stream is nb/4 characters long.****************************************************************************** CALLED BY**       celp** CALLS*****************************************************************************/#include <stdio.h>puthex(nb, bits, line)int nb, bits[];char line[];{  int i, j;    for (j = 0; j < nb;)  {    i = 0;    do    {      i |= (bits[j]&1)<<(3 - j%4);    } while (++j%4 != 0);    sprintf(&line[j/4-1],"%X",i);  }}  /**************************************************************************** ROUTINE*               gethex (unpack a bitstream into an array of bits)** FUNCTION*               Input a pointer to a bitstream and number of bits,*               program returns an array of bits.** SYNOPSIS*               subroutine gethex(nb, bits, line)**   formal **                       data    I/O*       name            type    type    function*       -------------------------------------------------------------------*       nb		int	i	number of bits*       bits		int	o	bit array*       line		char	i	packed character bitstream****************************************************************************** DESCRIPTION**       This routine takes a string of hex characters and unpacks*       them into an array of bits, 4 bits for each character.****************************************************************************** CALLED BY**       celp** CALLS*****************************************************************************/gethex(nb, bits, line)int nb, bits[];char line[];{  int i, j;    for (j = 0; j < nb;)  {    sscanf(&line[j/4],"%1X",&i);    do    {      bits[j] = ((int) (i & (1 << (3 - j%4))) != 0);    } while (++j%4 != 0);  }}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -