Changeset 10998 in vbox for trunk/include
- Timestamp:
- Jul 30, 2008 4:22:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r10386 r10998 1021 1021 1022 1022 1023 /** @def RT_BSWAP_U64 1024 * Reverses the byte order of an uint64_t value. */ 1025 #if 0 1026 # define RT_BSWAP_U64(u64) RT_MAKE_U64(RT_H2BE_U32((u64) >> 32), RT_H2BE_U32((u64) & 0xffffffff)) 1027 #else 1028 # define RT_BSWAP_U64(u64) ASMByteSwapU64(u64) 1029 #endif 1030 1031 /** @def RT_BSWAP_U32 1032 * Converts uint32_t value from host to big endian byte order. */ 1033 #if 0 1034 # define RT_BSWAP_U32(u32) (RT_BYTE4(u32) | (RT_BYTE3(u32) << 8) | (RT_BYTE2(u32) << 16) | (RT_BYTE1(u32) << 24)) 1035 #else 1036 # define RT_BSWAP_U32(u32) ASMByteSwapU32(u32) 1037 #endif 1038 1039 /** @def RT_BSWAP_U16 1040 * Converts uint16_t value from host to big endian byte order. */ 1041 #if 0 1042 # define RT_BSWAP_U16(u16) (RT_HIBYTE(u16) | (RT_LOBYTE(u16) << 8)) 1043 #else 1044 # define RT_BSWAP_U16(u16) ASMByteSwapU16(u16) 1045 #endif 1046 1047 1023 1048 /** @def RT_H2LE_U64 1024 * Converts uint64_t value from host to little endian byte order. */ 1025 #define RT_H2LE_U64(u64) (u64) 1049 * Converts an uint64_t value from host to little endian byte order. */ 1050 #ifdef RT_BIG_ENDIAN 1051 # define RT_H2LE_U64(u64) RT_BSWAP_U64(u64) 1052 #else 1053 # define RT_H2LE_U64(u64) (u64) 1054 #endif 1026 1055 1027 1056 /** @def RT_H2LE_U32 1028 * Converts uint32_t value from host to little endian byte order. */ 1029 #define RT_H2LE_U32(u32) (u32) 1057 * Converts an uint32_t value from host to little endian byte order. */ 1058 #ifdef RT_BIG_ENDIAN 1059 # define RT_H2LE_U32(u32) RT_BSWAP_U32(u32) 1060 #else 1061 # define RT_H2LE_U32(u32) (u32) 1062 #endif 1030 1063 1031 1064 /** @def RT_H2LE_U16 1032 * Converts uint16_t value from host to little endian byte order. */ 1033 #define RT_H2LE_U16(u16) (u16) 1065 * Converts an uint16_t value from host to little endian byte order. */ 1066 #ifdef RT_BIG_ENDIAN 1067 # define RT_H2LE_U16(u16) RT_BSWAP_U16(u16) 1068 #else 1069 # define RT_H2LE_U16(u16) (u16) 1070 #endif 1034 1071 1035 1072 /** @def RT_LE2H_U64 1036 * Converts uint64_t value from little endian to host byte order. */ 1037 #define RT_LE2H_U64(u64) (u64) 1073 * Converts an uint64_t value from little endian to host byte order. */ 1074 #ifdef RT_BIG_ENDIAN 1075 # define RT_LE2H_U64(u64) RT_BSWAP_U64(u64) 1076 #else 1077 # define RT_LE2H_U64(u64) (u64) 1078 #endif 1038 1079 1039 1080 /** @def RT_LE2H_U32 1040 * Converts uint32_t value from little endian to host byte order. */ 1041 #define RT_LE2H_U32(u32) (u32) 1081 * Converts an uint32_t value from little endian to host byte order. */ 1082 #ifdef RT_BIG_ENDIAN 1083 # define RT_LE2H_U32(u32) RT_BSWAP_U32(u32) 1084 #else 1085 # define RT_LE2H_U32(u32) (u32) 1086 #endif 1042 1087 1043 1088 /** @def RT_LE2H_U16 1044 * Converts uint16_t value from little endian to host byte order. */ 1045 #define RT_LE2H_U16(u16) (u16) 1089 * Converts an uint16_t value from little endian to host byte order. */ 1090 #ifdef RT_BIG_ENDIAN 1091 # define RT_LE2H_U16(u16) RT_BSWAP_U16(u16) 1092 #else 1093 # define RT_LE2H_U16(u16) (u16) 1094 #endif 1046 1095 1047 1096 1048 1097 /** @def RT_H2BE_U64 1049 * Converts uint64_t value from host to big endian byte order. */ 1050 #define RT_H2BE_U64(u64) RT_MAKE_U64(RT_H2BE_U32((u64) >> 32), RT_H2BE_U32((u64) & 0xffffffff)) 1098 * Converts an uint64_t value from host to big endian byte order. */ 1099 #ifdef RT_BIG_ENDIAN 1100 # define RT_H2BE_U64(u64) (u64) 1101 #else 1102 # define RT_H2BE_U64(u64) RT_BSWAP_U64(u64) 1103 #endif 1051 1104 1052 1105 /** @def RT_H2BE_U32 1053 * Converts uint32_t value from host to big endian byte order. */ 1054 #define RT_H2BE_U32(u32) (RT_BYTE4(u32) | (RT_BYTE3(u32) << 8) | (RT_BYTE2(u32) << 16) | (RT_BYTE1(u32) << 24)) 1106 * Converts an uint32_t value from host to big endian byte order. */ 1107 #ifdef RT_BIG_ENDIAN 1108 # define RT_H2BE_U32(u32) (u32) 1109 #else 1110 # define RT_H2BE_U32(u32) RT_BSWAP_U32(u32) 1111 #endif 1055 1112 1056 1113 /** @def RT_H2BE_U16 1057 * Converts uint16_t value from host to big endian byte order. */ 1058 #define RT_H2BE_U16(u16) (RT_HIBYTE(u16) | (RT_LOBYTE(u16) << 8)) 1114 * Converts an uint16_t value from host to big endian byte order. */ 1115 #ifdef RT_BIG_ENDIAN 1116 # define RT_H2BE_U16(u16) (u16) 1117 #else 1118 # define RT_H2BE_U16(u16) RT_BSWAP_U16(u16) 1119 #endif 1059 1120 1060 1121 /** @def RT_BE2H_U64 1061 * Converts uint64_t value from big endian to host byte order. */ 1062 #define RT_BE2H_U64(u64) RT_MAKE_U64(RT_H2BE_U32((u64) >> 32), RT_H2BE_U32((u64) & 0xffffffff)) 1122 * Converts an uint64_t value from big endian to host byte order. */ 1123 #ifdef RT_BIG_ENDIAN 1124 # define RT_BE2H_U64(u64) (u64) 1125 #else 1126 # define RT_BE2H_U64(u64) RT_BSWAP_U64(u64) 1127 #endif 1063 1128 1064 1129 /** @def RT_BE2H_U32 1065 * Converts uint32_t value from big endian to host byte order. */ 1066 #define RT_BE2H_U32(u32) (RT_BYTE4(u32) | (RT_BYTE3(u32) << 8) | (RT_BYTE2(u32) << 16) | (RT_BYTE1(u32) << 24)) 1130 * Converts an uint32_t value from big endian to host byte order. */ 1131 #ifdef RT_BIG_ENDIAN 1132 # define RT_BE2H_U32(u32) (u32) 1133 #else 1134 # define RT_BE2H_U32(u32) RT_BSWAP_U32(u32) 1135 #endif 1067 1136 1068 1137 /** @def RT_BE2H_U16 1069 * Converts uint16_t value from big endian to host byte order. */ 1070 #define RT_BE2H_U16(u16) (RT_HIBYTE(u16) | (RT_LOBYTE(u16) << 8)) 1071 1138 * Converts an uint16_t value from big endian to host byte order. */ 1139 #ifdef RT_BIG_ENDIAN 1140 # define RT_BE2H_U16(u16) (u16) 1141 #else 1142 # define RT_BE2H_U16(u16) RT_BSWAP_U16(u16) 1143 #endif 1144 1145 1146 /** @def RT_H2N_U64 1147 * Converts an uint64_t value from host to network byte order. */ 1148 #define RT_H2N_U64(u64) RT_H2BE_U64(u64) 1072 1149 1073 1150 /** @def RT_H2N_U32 1074 * Converts uint32_t value from host to network byte order. */1075 #define RT_H2N_U32(u32) RT_H2BE_U32(u32)1151 * Converts an uint32_t value from host to network byte order. */ 1152 #define RT_H2N_U32(u32) RT_H2BE_U32(u32) 1076 1153 1077 1154 /** @def RT_H2N_U16 1078 * Converts uint16_t value from host to network byte order. */ 1079 #define RT_H2N_U16(u16) RT_H2BE_U16(u16) 1155 * Converts an uint16_t value from host to network byte order. */ 1156 #define RT_H2N_U16(u16) RT_H2BE_U16(u16) 1157 1158 /** @def RT_N2H_U64 1159 * Converts an uint64_t value from network to host byte order. */ 1160 #define RT_N2H_U64(u64) RT_BE2H_U64(u64) 1080 1161 1081 1162 /** @def RT_N2H_U32 1082 * Converts uint32_t value from network to host byte order. */1083 #define RT_N2H_U32(u32) RT_BE2H_U32(u32)1163 * Converts an uint32_t value from network to host byte order. */ 1164 #define RT_N2H_U32(u32) RT_BE2H_U32(u32) 1084 1165 1085 1166 /** @def RT_N2H_U16 1086 * Converts uint16_t value from network to host byte order. */1087 #define RT_N2H_U16(u16) RT_BE2H_U16(u16)1167 * Converts an uint16_t value from network to host byte order. */ 1168 #define RT_N2H_U16(u16) RT_BE2H_U16(u16) 1088 1169 1089 1170
Note:
See TracChangeset
for help on using the changeset viewer.