Changeset 233
- Timestamp:
- Apr 22, 2006, 2:27:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/internal.h
r162 r233 69 69 /* Convenient macros to perform uint32_t endian conversions with 70 70 char pointers */ 71 #define TR_NTOHL(p,a) (a) = ntohl(*((uint32_t*)(p))) 72 #define TR_HTONL(a,p) *((uint32_t*)(p)) = htonl((a)) 71 #define TR_NTOHL(p,a) (a) = tr_ntohl((p)) 72 #define TR_HTONL(a,p) tr_htonl((a), (p)) 73 static inline uint32_t tr_ntohl( uint8_t * p ) 74 { 75 uint32_t u; 76 memcpy( &u, p, sizeof( uint32_t ) ); 77 return ntohl( u ); 78 } 79 static inline void tr_htonl( uint32_t a, uint8_t * p ) 80 { 81 uint32_t u; 82 u = htonl( a ); 83 memcpy ( p, &u, sizeof( uint32_t ) ); 84 } 73 85 74 86 /* Sometimes the system defines MAX/MIN, sometimes not. In the latter
Note: See TracChangeset
for help on using the changeset viewer.