netmsgs/libnetmsgs/nmLibPack.c
int nmPackP32(void *val, byte_t buf[], size_t bufSize, NMEndian_T eEndian)
{
  static size_t fvalLen = NMFVAL_LEN_P32;     // message field value length
  ulong_t       luVal;
  uint_t        uVal;

  _NM_CHK_MEM(bufSize, fvalLen);

  // long's are same size as void *'s. exceptions?
  luVal = *((ulong_t *)val);

  // 4-byte natvie pointer
  if( sizeof(void *) == fvalLen )
  {
    PACKNATIVE(luVal, buf);
  }

  // 8-byte native pointer - "convert"
  if( sizeof(void *) == NMFVAL_LEN_P64 )
  {
#if HOST_WORD_SIZE == 64
    //if( luVal & 0xffffffff00000000 )
    if( (luVal) & 0xffffffff00000000 )
    {
      NMLIB_WARNING("%p: Packing 64-bit pointer in 32 bits lost non-zero "
                    "significance.", (void *)luVal);
    }
#endif // HOST_WORD_SIZE
    uVal = (uint_t)(luVal & 0xffffffff);
    PACKNATIVE(uVal, buf);
  }


  return (int)fvalLen;
}
/*!
 * \brief Pack a 32-bit pointer into the message buffer.
 *
 * If the machine architecture has 64-bit pointers, then only the 
 * LSB 4 bytes are packed.
 *
 * \note Pointer is always packed in native byte order.
 *
 * \copydoc doc_params_pack_std
 * \copydoc doc_return_pack_std 
 */
\brief Pack a 32-bit pointer into the message buffer.
If the machine architecture has 64-bit pointers, then only the
LSB 4 bytes are packed.

\note Pointer is always packed in native byte order.


\ brief Pack a 32 - bit pointer into the message buffer . If the machine architecture has 64 - bit pointers then only the LSB 4 bytes are packed . \ note Pointer is always packed in native byte order .
int nmPackP32(void *val, byte_t buf[], size_t bufSize, NMEndian_T eEndian)
{
  static size_t fvalLen = NMFVAL_LEN_P32;     
  ulong_t       luVal;
  uint_t        uVal;
  _NM_CHK_MEM(bufSize, fvalLen);
  luVal = *((ulong_t *)val);
  if( sizeof(void *) == fvalLen )
  {
    PACKNATIVE(luVal, buf);
  }
  if( sizeof(void *) == NMFVAL_LEN_P64 )
  {
#if HOST_WORD_SIZE == 64
    if( (luVal) & 0xffffffff00000000 )
    {
      NMLIB_WARNING("%p: Packing 64-bit pointer in 32 bits lost non-zero "
                    "significance.", (void *)luVal);
    }
#endif 
    uVal = (uint_t)(luVal & 0xffffffff);
    PACKNATIVE(uVal, buf);
  }
  return (int)fvalLen;
}
int nmPackP32 ( void * val , byte_t buf [ ] , size_t bufSize , NMEndian_T eEndian ) { static size_t fvalLen = NMFVAL_LEN_P32 ; ulong_t luVal ; uint_t uVal ; _NM_CHK_MEM ( bufSize , fvalLen ) ; luVal = * ( ( ulong_t * ) val ) ; if ( sizeof ( void * ) == fvalLen ) { PACKNATIVE ( luVal , buf ) ; } if ( sizeof ( void * ) == NMFVAL_LEN_P64 ) { #if HOST_WORD_SIZE == 64 if ( ( luVal ) & 0xffffffff00000000 ) { NMLIB_WARNING ( " " " " , ( void * ) luVal ) ; } #endif uVal = ( uint_t ) ( luVal & 0xffffffff ) ; PACKNATIVE ( uVal , buf ) ; } return ( int ) fvalLen ; }
\brief Pack a 32-bit pointer into the message buffer.
\ brief Pack a 32 - bit pointer into the message buffer .
// message field value length // long's are same size as void *'s. exceptions? // 4-byte natvie pointer // 8-byte native pointer - "convert" //if( luVal & 0xffffffff00000000 ) // HOST_WORD_SIZE