netmsgs/libnetmsgs/nmLibPack.c
int nmUnpackS64(byte_t buf[],
                size_t bufSize,
                long long *pVal,
                NMEndian_T eEndian)
{
  static size_t fvalLen = NMFVAL_LEN_S64;     // message field value length

  uint_t        uMSB;     // most significant bytes
  uint_t        uLSB;     // least signifcant bytes

  _NM_CHK_MEM(bufSize, fvalLen);

  // 8-byte unsigned long long
  if( sizeof(ulonglong_t) == fvalLen )
  {
    switch( eEndian )
    {
      case NMEndianLittle:
        UNPACKLITTLE(buf, pVal);
        break;
      case NMEndianNative:
        UNPACKNATIVE(buf, pVal);
        break;
      case NMEndianBig:
      default:
        UNPACKBIG(buf, pVal);
        break;
    }
  }

  // 4-byte unsigned long long
  else
  {
    _NM_CHK_ARCH(*pVal, (size_t)NMFVAL_LEN_S32);

    switch( eEndian )
    {
      case NMEndianLittle:
        UNPACK64LITTLE(buf, &uMSB, &uLSB);
        break;
      case NMEndianNative:
        UNPACK64NATIVE(buf, &uMSB, &uLSB);
        break;
      case NMEndianBig:
      default:
        UNPACK64BIG(buf, &uMSB, &uLSB);
        break;
    }

    if( (uMSB != 0) && (uMSB != 0xffffffff) )
    {
      NMLIB_WARNING("0x%08x%08x: Unpacking signed 64-bit integer into "
                    "32 bits lost non-zero significance.",
                    uMSB, uLSB);
    }

    *pVal = (long long)uLSB;
  }

  return (int)fvalLen;
}
/*!
 * \brief Unpack an signed 64-bit integer from the message buffer.
 *
 * If the machine architecture only supports 32-bit long longs, then
 * the 4 MSBs are truncated.
 *
 * \copydoc doc_params_unpack_std
 * \copydoc doc_return_unpack_std
 */
\brief Unpack an signed 64-bit integer from the message buffer.
If the machine architecture only supports 32-bit long longs, then
the 4 MSBs are truncated.


\ brief Unpack an signed 64 - bit integer from the message buffer . If the machine architecture only supports 32 - bit long longs then the 4 MSBs are truncated .
int nmUnpackS64(byte_t buf[],
                size_t bufSize,
                long long *pVal,
                NMEndian_T eEndian)
{
  static size_t fvalLen = NMFVAL_LEN_S64;     
  uint_t        uMSB;     
  uint_t        uLSB;     
  _NM_CHK_MEM(bufSize, fvalLen);
  if( sizeof(ulonglong_t) == fvalLen )
  {
    switch( eEndian )
    {
      case NMEndianLittle:
        UNPACKLITTLE(buf, pVal);
        break;
      case NMEndianNative:
        UNPACKNATIVE(buf, pVal);
        break;
      case NMEndianBig:
      default:
        UNPACKBIG(buf, pVal);
        break;
    }
  }
  else
  {
    _NM_CHK_ARCH(*pVal, (size_t)NMFVAL_LEN_S32);
    switch( eEndian )
    {
      case NMEndianLittle:
        UNPACK64LITTLE(buf, &uMSB, &uLSB);
        break;
      case NMEndianNative:
        UNPACK64NATIVE(buf, &uMSB, &uLSB);
        break;
      case NMEndianBig:
      default:
        UNPACK64BIG(buf, &uMSB, &uLSB);
        break;
    }
    if( (uMSB != 0) && (uMSB != 0xffffffff) )
    {
      NMLIB_WARNING("0x%08x%08x: Unpacking signed 64-bit integer into "
                    "32 bits lost non-zero significance.",
                    uMSB, uLSB);
    }
    *pVal = (long long)uLSB;
  }
  return (int)fvalLen;
}
int nmUnpackS64 ( byte_t buf [ ] , size_t bufSize , long long * pVal , NMEndian_T eEndian ) { static size_t fvalLen = NMFVAL_LEN_S64 ; uint_t uMSB ; uint_t uLSB ; _NM_CHK_MEM ( bufSize , fvalLen ) ; if ( sizeof ( ulonglong_t ) == fvalLen ) { switch ( eEndian ) { case NMEndianLittle : UNPACKLITTLE ( buf , pVal ) ; break ; case NMEndianNative : UNPACKNATIVE ( buf , pVal ) ; break ; case NMEndianBig : default : UNPACKBIG ( buf , pVal ) ; break ; } } else { _NM_CHK_ARCH ( * pVal , ( size_t ) NMFVAL_LEN_S32 ) ; switch ( eEndian ) { case NMEndianLittle : UNPACK64LITTLE ( buf , & uMSB , & uLSB ) ; break ; case NMEndianNative : UNPACK64NATIVE ( buf , & uMSB , & uLSB ) ; break ; case NMEndianBig : default : UNPACK64BIG ( buf , & uMSB , & uLSB ) ; break ; } if ( ( uMSB != 0 ) && ( uMSB != 0xffffffff ) ) { NMLIB_WARNING ( " " " " , uMSB , uLSB ) ; } * pVal = ( long long ) uLSB ; } return ( int ) fvalLen ; }
\brief Unpack an signed 64-bit integer from the message buffer.
\ brief Unpack an signed 64 - bit integer from the message buffer .
// message field value length // most significant bytes // least signifcant bytes // 8-byte unsigned long long // 4-byte unsigned long long