bitroutines.h

来自「wcdma模型」· C头文件 代码 · 共 64 行

H
64
字号
/* | | Copyright disclaimer: |   This software was developed at the National Institute of Standards |   and Technology by employees of the Federal Government in the course |   of their official duties. Pursuant to title 17 Section 105 of the |   United States Code this software is not subject to copyright |   protection and is in the public domain. | |   We would appreciate acknowledgement if the software is used. |*//* | Project:	WCDMA simulation environment | Module:      Bit manipulation routines | Author:      Tommi Makelainen, NIST | Date:        January 6, 1999 | | History: |              January 6, 1999 Tommi Makelainen |                      Initial version. | */#include <stdio.h>#include <math.h>/* -------------------------------------------------------------------- *//* * Function:	extract_bit_from_byte * Desc.:	Extract given single bit value from a given byte. * * Inputs: *   byte	input byte *   pos	bit position (7-0) 7 = leftmost, 0 = bit on the right * Returns: *              bit value (0 or 1) * * Note:	 */char extract_bit_from_byte(char byte, int pos);/* -------------------------------------------------------------------- *//* * Function:	set_bit_in_byte * Desc.:	Set a value of a single bit 'bit' in given *              position 'pos' in a byte 'byte'. * * Inputs: *   bit	input bit value *   pos	bit position to set * Outputs: *   byte	modified byte * * Note:	 */int set_bit_in_byte(char bit, int pos, char *byte);/* -------------------------------------------------------------------- */

⌨️ 快捷键说明

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