mmi_util_bit_array_macros.h

来自「Motorola synergy audio component」· C头文件 代码 · 共 71 行

H
71
字号
#ifndef MMI_UTIL_BIT_ARRAY_MACROS_INCLUDE#define MMI_UTIL_BIT_ARRAY_MACROS_INCLUDE#ifdef __cplusplusextern "C" {#endif/* (c) Copyright Motorola 1997, All rights reserved.           Motorola Confidential Proprietary   Contains confidential proprietary information of Motorola, Inc.   Reverse engineering is prohibited.   The copyright notice does not imply publication.     DESCRIPTION:        This header file contains macros for bit array manipulation.       The macros include the ability to retrieve, set, and unset the       value of any bit in a bit array.  ************** REVISION HISTORY **********************************************     Date       Author      Reference   ========   ========    ==========================   97.06.10   joshuag     PR - CSGce10240                Development for Speaker Dependent Voice Recognition.              - Initial creation.  *//************** HEADER FILE INCLUDES ******************************************/          /************** CONSTANTS *****************************************************//************** STRUCTURES, ENUMS, AND TYPEDEFS *******************************//************** FUNCTION PROTOTYPES *******************************************//************** MACROS ********************************************************/// For bit arrays using UINT8 or INT8 data types.// Retrieve the value of the specified bit (0, 1) from the specified bit array.#define MMI_UTIL_get_bit_8(bit_array_ptr, bit_num)   (bit_array_ptr[bit_num >> 3] &  (1 << bit_num % 8) ? 1 : 0)// Set the value of the specified bit to 1 from the specified bit array.#define MMI_UTIL_set_bit_8(bit_array_ptr, bit_num)   (bit_array_ptr[bit_num >> 3] |= (1 << bit_num % 8))// Unset the value of the specified bit to 0 from the specified bit array.#define MMI_UTIL_unset_bit_8(bit_array_ptr, bit_num) (bit_array_ptr[bit_num >> 3] &= (0xFF ^ (1 << bit_num % 8)))// For bit arrays using UINT16 or INT16 data types. // Retrieve the value of the specified bit (0, 1) from the specified bit array.#define MMI_UTIL_get_bit_16(bit_array_ptr, bit_num)   (bit_array_ptr[bit_num >> 4] &  (1 << bit_num % 16) ? 1 : 0)// Set the value of the specified bit to 1 from the specified bit array.#define MMI_UTIL_set_bit_16(bit_array_ptr, bit_num)   (bit_array_ptr[bit_num >> 4] |= (1 << bit_num % 16))// Unset the value of the specified bit to 0 from the specified bit array.#define MMI_UTIL_unset_bit_16(bit_array_ptr, bit_num) (bit_array_ptr[bit_num >> 4] &= (0xFFFF ^ (1 << bit_num % 16)))/************** CLASS DEFINITIONS *********************************************//************** GLOBAL VARIABLES **********************************************/#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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