81 lines
2.7 KiB
C
81 lines
2.7 KiB
C
/*****************************************************************************
|
|
* Copyright (C) 2004-2021
|
|
* ProbeStar Technical Systems, LLC
|
|
* All Rights Reserved. Proprietary and Confidential.
|
|
*============================================================================
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* includes
|
|
*****************************************************************************/
|
|
|
|
#include "embtypes.h"
|
|
#include "asn1uper.h"
|
|
|
|
/*****************************************************************************
|
|
* defines
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* macros
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* structs & typedefs
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static prototypes
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* C functions
|
|
*****************************************************************************/
|
|
|
|
void uper_put_bitstream(UPER_Stream *uper, UPER_BitStream *bs)
|
|
{
|
|
if (!uper || !bs)
|
|
return;
|
|
|
|
// limit 64 bits
|
|
uper_put_bits_stream(uper, bs->value, bs->max);
|
|
}
|
|
|
|
// from the front (high->low bits)
|
|
void uper_set_bit_bitstream(UPER_BitStream *bs, uint bit, uint max)
|
|
{
|
|
if (!bs || !max)
|
|
return;
|
|
bs->max = max;
|
|
|
|
if (bit)
|
|
bs->value |= 1<<(bs->max-bit-1);
|
|
else
|
|
bs->value &= ~(1<<(bs->max-bit-1));
|
|
}
|
|
|
|
void uper_set_bits_bitstream(UPER_BitStream *bs, uint64_t value, uint max)
|
|
{
|
|
if (!bs)
|
|
return;
|
|
|
|
bs->value = value;
|
|
bs->max = max;
|
|
}
|