Changeset 362
- Timestamp:
- Mar 24, 2006 8:45:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/types.h
r228 r362 295 295 PJ_DECL(pj_status_t) pj_init(void); 296 296 297 /** 298 * Swap the byte order of an 16bit data. 299 * 300 * @param val16 The 16bit data. 301 * 302 * @return An 16bit data with swapped byte order. 303 */ 304 PJ_INLINE(pj_int16_t) pj_swap16(pj_int16_t val16) 305 { 306 pj_uint8_t *p = (pj_uint8_t*)&val16; 307 pj_uint8_t tmp = *p; 308 *p = *(p+1); 309 *(p+1) = tmp; 310 return val16; 311 } 312 313 /** 314 * Swap the byte order of an 32bit data. 315 * 316 * @param val16 The 32bit data. 317 * 318 * @return An 32bit data with swapped byte order. 319 */ 320 PJ_INLINE(pj_int32_t) pj_swap32(pj_int32_t val32) 321 { 322 pj_uint8_t *p = (pj_uint8_t*)&val32; 323 pj_uint8_t tmp = *p; 324 *p = *(p+3); 325 *(p+3) = tmp; 326 tmp = *(p+1); 327 *(p+1) = *(p+2); 328 *(p+2) = tmp; 329 return val32; 330 } 331 297 332 298 333 /**
Note: See TracChangeset
for help on using the changeset viewer.