/*************************************************************************** * Copyright (c) 2003-2008, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Revision History: * * $brcm_Log: $ * * ***************************************************************************/ #if !defined(__GETBITS_H__) #define __GETBITS_H__ #include "bapp_types.h" struct bit_state_t { unsigned char * data; /* data start pointer */ size_t bindex; /* bit index */ }; /* Return bit_count of bits from the bitstream. bit_count can be anywhere from 0 to 16. The bit_state_t structure has to be reset after 536870911 bytes as bindex is 32 bit value. This is not a practical limitation. */ unsigned int get_bits(size_t bit_count, struct bit_state_t * bs); /* Return bit_count of bits from bitstream. bit_count can be anywhere from 0 to 32. This function can be called only when bit field to be returned is aligned on a byte boundary. Most new standards follow this rule. */ unsigned int get_bits_aligned(size_t bit_count, struct bit_state_t * bs); #endif