netmsgs/libnetmsgs/nmLibUtils.c
void nmPrintBits(FILE        *fp,
                 const char  *sPreface,
                 ulonglong_t  uVal,
                 uint_t       uMsb,
                 uint_t       uCnt)
{
  uint_t i;

  if( sPreface && *sPreface )
  {
    fprintf(fp, "%s:", sPreface);
  }

  for(i=0; i<uCnt; ++i)
  {
    if( (uMsb % 8) == 7 )
    {
      if( i != 0 )
      {
        printf(" ");
      }
    }
    (uVal >> uMsb) & 0x01?  printf("1"): printf("0");
    --uMsb;
  }
}
/*!
 * \brief Pretty print bits in value.
 *
 * \param fp        File pointer.
 * \param sPreface  Optional bit preface string (set to NULL for no preface).
 * \param uVal      Bits to print.
 * \param uMsb      Starting most significant bit.
 * \param uCnt      Number of bits.
 */
\brief Pretty print bits in value.
\param fp        File pointer.
\param sPreface  Optional bit preface string (set to NULL for no preface).
\param uVal      Bits to print.
\param uMsb      Starting most significant bit.
\param uCnt      Number of bits.
\ brief Pretty print bits in value . \ param fp File pointer . \ param sPreface Optional bit preface string ( set to NULL for no preface ) . \ param uVal Bits to print . \ param uMsb Starting most significant bit . \ param uCnt Number of bits .
void nmPrintBits(FILE        *fp,
                 const char  *sPreface,
                 ulonglong_t  uVal,
                 uint_t       uMsb,
                 uint_t       uCnt)
{
  uint_t i;
  if( sPreface && *sPreface )
  {
    fprintf(fp, "%s:", sPreface);
  }
  for(i=0; i<uCnt; ++i)
  {
    if( (uMsb % 8) == 7 )
    {
      if( i != 0 )
      {
        printf(" ");
      }
    }
    (uVal >> uMsb) & 0x01?  printf("1"): printf("0");
    --uMsb;
  }
}
void nmPrintBits ( FILE * fp , const char * sPreface , ulonglong_t uVal , uint_t uMsb , uint_t uCnt ) { uint_t i ; if ( sPreface && * sPreface ) { fprintf ( fp , " " , sPreface ) ; } for ( i = 0 ; i < uCnt ; ++ i ) { if ( ( uMsb % 8 ) == 7 ) { if ( i != 0 ) { printf ( " " ) ; } } ( uVal >> uMsb ) & 0x01 ? printf ( " " ) : printf ( " " ) ; -- uMsb ; } }
\brief Pretty print bits in value.
\ brief Pretty print bits in value .