[En-Nut-Discussion] DHCP option one byte offset (Big Endian)?

Tyou tyou at i-da.co.jp
Tue Jul 29 11:26:04 CEST 2003


I use this function . I've compared the asm list outputs, and
think it is better.
/*! 
 * \brief Read Long word ,memory alignment ignored.
 * could be "inline".
 */
u_long LongBoundary(void* pt)
{
    u_long  ultmp;
    u_char* psrc;
    u_char* pdst;
    
    pdst = (u_char*)(&ultmp);
    psrc = (u_char*)pt;
    
    *pdst++ = *psrc++;
    *pdst++ = *psrc++;
    *pdst++ = *psrc++;
    *pdst      = *psrc;
    
    return ultmp;
    
}




More information about the En-Nut-Discussion mailing list