SILC_SWAB_32

NAME

    #define SILC_SWAB_32(integer)

DESCRIPTION

Swabs 32-bit unsigned integer byte order. Returns the new value.

SOURCE

#if (defined(SILC_I486) || defined(SILC_X86_64)) && defined(__GNUC__)
#define SILC_SWAB_32(l)                         \
({                                              \
  SilcUInt32 _result_;                          \
  asm volatile ("movl %1, %0; bswapl %0"        \
                : "=q" (_result_) : "q" (l));   \
  _result_;                                     \
})
#else
#define SILC_SWAB_32(l)                                                 \
  ((SilcUInt32)(((SilcUInt32)(l) & (SilcUInt32)0x000000FFUL) << 24) |   \
               (((SilcUInt32)(l) & (SilcUInt32)0x0000FF00UL) << 8)  |   \
               (((SilcUInt32)(l) & (SilcUInt32)0x00FF0000UL) >> 8)  |   \
               (((SilcUInt32)(l) & (SilcUInt32)0xFF000000UL) >> 24))
#endif /* (SILC_I486 || SILC_X86_64) && __GNUC__ */