Changeset 2954 for trunk/kLdr/kLdrHlp.h
- Timestamp:
- Feb 7, 2007, 5:42:32 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrHlp.h
r2944 r2954 46 46 #define KLDR_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) ) 47 47 48 /** @def KLDRHLP_LE2H_U16 49 * Unsigned 16-bit little-endian to host translation. */ 50 /** @def KLDRHLP_LE2H_U32 51 * Unsigned 32-bit little-endian to host translation. */ 52 #if 1 53 # define KLDRHLP_LE2H_U16(u16) ((uint16_t)(u16)) 54 # define KLDRHLP_ LE2H_U32(u32) ((uint32_t)(u32))55 #else 56 # define KLDRHLP_LE2H_U16(u16) ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) ) 57 # define KLDRHLP_ LE2H_U32(u32)( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \48 49 /** @name Endian Conversion 50 * @{ */ 51 52 /** @def KLDRHLP_E2E_U16 53 * Convert the endian of an unsigned 16-bit value. */ 54 # define KLDRHLP_E2E_U16(u16) ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) ) 55 /** @def KLDRHLP_E2E_U32 56 * Convert the endian of an unsigned 32-bit value. */ 57 # define KLDRHLP_E2E_U32(u32) ( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \ 58 58 | ( ((u32) & UINT32_C(0x00ff0000)) >> 8 ) \ 59 59 | ( ((u32) & UINT32_C(0x0000ff00)) << 8 ) \ 60 60 | ( ((u32) & UINT32_C(0x000000ff)) << 24 ) \ 61 61 ) 62 #endif 62 /** @def KLDRHLP_E2E_U64 63 * Convert the endian of an unsigned 64-bit value. */ 64 # define KLDRHLP_E2E_U64(u64) ( ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \ 65 | ( ((u64) & UINT64_C(0x00ff000000000000)) >> 40 ) \ 66 | ( ((u64) & UINT64_C(0x0000ff0000000000)) >> 24 ) \ 67 | ( ((u64) & UINT64_C(0x000000ff00000000)) >> 8 ) \ 68 | ( ((u64) & UINT64_C(0x00000000ff000000)) << 8 ) \ 69 | ( ((u64) & UINT64_C(0x0000000000ff0000)) << 24 ) \ 70 | ( ((u64) & UINT64_C(0x000000000000ff00)) << 40 ) \ 71 | ( ((u64) & UINT64_C(0x00000000000000ff)) << 56 ) \ 72 ) 73 74 /** @def KLDRHLP_LE2H_U16 75 * Unsigned 16-bit little-endian to host endian. */ 76 /** @def KLDRHLP_LE2H_U32 77 * Unsigned 32-bit little-endian to host endian. */ 78 /** @def KLDRHLP_LE2H_U64 79 * Unsigned 64-bit little-endian to host endian. */ 80 /** @def KLDRHLP_BE2H_U16 81 * Unsigned 16-bit big-endian to host endian. */ 82 /** @def KLDRHLP_BE2H_U32 83 * Unsigned 32-bit big-endian to host endian. */ 84 /** @def KLDRHLP_BE2H_U64 85 * Unsigned 64-bit big-endian to host endian. */ 86 #if 1 87 # define KLDRHLP_LE2H_U16(u16) ((uint16_t)(u16)) 88 # define KLDRHLP_LE2H_U32(u32) ((uint32_t)(u32)) 89 # define KLDRHLP_LE2H_U64(u64) ((uint32_t)(u32)) 90 # define KLDRHLP_BE2H_U16(u16) KLDRHLP_E2E_U16(u16) 91 # define KLDRHLP_BE2H_U32(u32) KLDRHLP_E2E_U32(u32) 92 # define KLDRHLP_BE2H_U64(u64) KLDRHLP_E2E_U64(u64) 93 #else 94 # define KLDRHLP_LE2H_U16(u16) KLDRHLP_E2E_U16(u16) 95 # define KLDRHLP_LE2H_U32(u32) KLDRHLP_E2E_U32(u32) 96 # define KLDRHLP_LE2H_U32(u64) KLDRHLP_E2E_U64(u64) 97 # define KLDRHLP_BE2H_U16(u16) ((uint16_t)(u16)) 98 # define KLDRHLP_BE2H_U32(u32) ((uint32_t)(u32)) 99 # define KLDRHLP_BE2H_U64(u64) ((uint32_t)(u32)) 100 #endif 101 102 /** @} */ 103 63 104 64 105 /* … … 174 215 # ifdef __GNUC__ 175 216 # define kldrHlpBreakpoint() do { __asm__ __volatile__ ("int3\n\tnop"); } while (0) 176 # endif 217 # endif 177 218 # ifdef _MSC_VER 178 219 # define kldrHlpBreakpoint() __debugbreak() 179 # endif 180 181 #endif 220 # endif 221 222 #endif 182 223 183 224 #if (!defined(kLdrHlpMemChr) && !defined(kLdrHlpStrChr_needed))\ … … 196 237 #ifdef __cplusplus 197 238 extern "C" { 198 #endif 239 #endif 199 240 200 241 int kLdrHlpMemIComp(const void *pv1, const void *pv2, size_t cb); … … 230 271 #ifdef __cplusplus 231 272 } 232 #endif 273 #endif 233 274 234 275
Note:
See TracChangeset
for help on using the changeset viewer.