Changeset 8b49230 for lib/libtrace_int.h
- Timestamp:
- 08/30/13 13:30:41 (8 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- bf1029a
- Parents:
- 8780774
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace_int.h
r3799f51 r8b49230 59 59 #include "libtrace.h" 60 60 #include "wandio.h" 61 #include "lt_bswap.h" 61 62 62 63 #ifdef _MSC_VER … … 900 901 uint32_t *remaining); 901 902 902 /** Byteswaps a 64-bit value.903 *904 * @param num The value to be byteswapped.905 * @return The byteswapped 64-bit number906 *907 */908 uint64_t byteswap64(uint64_t num);909 910 /** Byteswaps a 32-bit value.911 *912 * @param num The value to be byteswapped.913 * @return The byteswapped 32-bit number914 *915 */916 uint32_t byteswap32(uint32_t num);917 918 /** Byteswaps a 16-bit value.919 *920 * @param num The value to be byteswapped.921 * @return The byteswapped 16-bit number922 *923 */924 uint16_t byteswap16(uint16_t num);925 926 /** @name Byte ordering927 * Macros that define how to convert a value into a particular byte-order928 *929 * @{930 */931 #if __BYTE_ORDER == __BIG_ENDIAN932 #define bswap_host_to_be64(num) ((uint64_t)(num))933 #define bswap_host_to_le64(num) byteswap64(num)934 #define bswap_host_to_be32(num) ((uint32_t)(num))935 #define bswap_host_to_le32(num) byteswap32(num)936 #define bswap_host_to_be16(num) ((uint16_t)(num))937 #define bswap_host_to_le16(num) byteswap16(num)938 939 #define bswap_be_to_host64(num) ((uint64_t)(num))940 #define bswap_le_to_host64(num) byteswap64(num)941 #define bswap_be_to_host32(num) ((uint32_t)(num))942 #define bswap_le_to_host32(num) byteswap32(num)943 #define bswap_be_to_host16(num) ((uint16_t)(num))944 #define bswap_le_to_host16(num) byteswap16(num)945 946 /* We use ntoh*() here, because the compiler may947 * attempt to optimise it948 */949 #elif __BYTE_ORDER == __LITTLE_ENDIAN950 #define bswap_host_to_be64(num) (byteswap64(num))951 #define bswap_host_to_le64(num) ((uint64_t)(num))952 #define bswap_host_to_be32(num) (htonl(num))953 #define bswap_host_to_le32(num) ((uint32_t)(num))954 #define bswap_host_to_be16(num) (htons(num))955 #define bswap_host_to_le16(num) ((uint16_t)(num))956 957 #define bswap_be_to_host64(num) (byteswap64(num))958 #define bswap_le_to_host64(num) ((uint64_t)(num))959 #define bswap_be_to_host32(num) (ntohl(num))960 #define bswap_le_to_host32(num) ((uint32_t)(num))961 #define bswap_be_to_host16(num) (ntohs(num))962 #define bswap_le_to_host16(num) ((uint16_t)(num))963 964 #else965 #error "Unknown byte order"966 #endif967 /** @} */968 903 969 904 #ifdef HAVE_BPF
Note: See TracChangeset
for help on using the changeset viewer.